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 Link to comment https://forums.phpfreaks.com/topic/37869-need-help-with-two-regexes-prob-quite-simple-but-im-stumped-6am-tho/ Share on other sites More sharing options...
effigy Posted February 10, 2007 Share Posted February 10, 2007 See this topic. Link to comment https://forums.phpfreaks.com/topic/37869-need-help-with-two-regexes-prob-quite-simple-but-im-stumped-6am-tho/#findComment-181308 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.