CptnChainsaw Posted February 10, 2007 Share Posted February 10, 2007 Hi all, I've been programming perl for a couple of years and I'm doing some PHP5 at the moment. I have a problem with two of my regexes: This regex: $this->_html = preg_replace('<head>', '<head><style type="text/css">enlarge {color:#FF00FF;}</style>', $this->_html); Produces: <<head><style type="text/css">enlarge {color:#FF00FF;}</style>> </<head><style type="text/css">enlarge {color:#FF00FF;}</style>> It should produce: <head><style type="text/css">enlarge {color:#FF00FF;}</style> </head> The second regex is: $html = preg_replace("$keywords[0]",'<span id="enlarge">$keywords[0]<[\/]span>', $html); which produces: Warning: preg_replace() [function.preg-replace]: Delimiter must not be alphanumeric or backslash in e:\free1\testacc\class.Highlighter.php on line 8 The above code is line 8. I have tried many variations but I'm having no luck. Also the second regex uses an array but before I loop over the array I want to get the regex working. How can I get these working? Cheers in advance for any help. CptnChainsaw Quote Link to comment Share on other sites More sharing options...
effigy Posted February 10, 2007 Share Posted February 10, 2007 See this topic. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.