> Hi all, > > I've got a regex that's working fine, apart from one little problem. > > $tags = array ("script", > "<!--<!\[CDATA\[", > "\]\]>-->");
A quick shot (perhaps I miss the point ;): if you do $x = "\["; then $x will contain "[". If you then do a regex with preg_match("/$x/", ..." eg. then it get's evaluated as preg_match("/[/", ... If you want the [ to be escaped in the regex you have to "double-escape" it: $x = "\ \["; (sorry, the two \ should be together without a space but my stupid mail-app converts the string thinking it's an network address) so $x will contain "\[" as you want ( the first backslash escapes the second). > foreach ($tags as $currentTag) > if (preg_match ("/^<\/". $currentTag. "/", $content)) > // do something > > > Witan Jardine > 13 Southampton Place > London WC1A 2AL > Tel: 020 7404 4004 I hope I didn't miss the point and could help you best regards Stefan Rusterholz -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]