Forum Moderators: coopster
if this is trivial, I plead guilty, but I have searched for an hour now and didn't find anything.
The caret ^ can be used to negate single characters if used inside square brackets, but outside they seem to stand for "start of line".
I'd like to match all html-tags with the exception of em, div class = "cite", li, and a couple more.
This one finds all applet, a, table tags, opening and closing. NOe, there must be some way to say "I don't want anything that's inside the round brackets?
<[/]?(applet¦a¦table)[^>]*>
Thanks for your help,
nerd
[wiki.tcl.tk...]
but I think better would be to find these appearances first, convert them to sth else (eg to [a], [applett]), perform the regex and return them to previous form.
Hope this helps
Michal
thanks for your input. I got myself a list of all html-tags and zap anything but the 4 or 5 that I'd like to keep. As long as the posts are rather small, I hope it won't bring down the box ...
But I'm still interested in the reason of this missing possibility (negating strings) - is it just too "expensive" to have it - or is it something that would be more than a "finite state automaton" can handle? (just curious)
nerd.
Also remember, preg_replace can take an array of patterns, and an array of replacements. So maybe implementing some sort of BBcode would provide a neater solution. That way you can have a simple regex to remove all tags, and then just replace the BBcode with their respective replacements. Just an idea :)
Good luck!