Re: preg_match_all for dummies
| From: | Jochem Maas | Date: | Thu, 24 Nov 2005 17:30:42 +0000 |
| Subject: | Re: preg_match_all for dummies | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-226413@lists.php.net to get a copy of this message | ||
Kristen G. Thorson wrote:
I am a regex retard.good for you ;-) why not take the easy route and simply strip out all HTML comments (and whatever maybe inside them) from the string(s) before you do the search for the 'bbcode'?
I am trying to pull keywords out of this crazy bbcode-like file, but only for bbcode-like code NOT enclosed in HTML comments. I currently have managed to create this regex: '/(?<!<!--)\[!(\w+)::.*!\](?!-->)/U' Which matches [!keyword::crazy bbcode!] and not <!--[!keyword::crazy bbcode!]-->
That's a step in the right direction. But it includes in the match keywords within phrases like this: <!-- A sentence including some [!keyword::crazy bbcode!]. --> I want to ignore all bbcode within HTML quotes. How do I do this? thanks kgt