Preg and why [^word) doesnt work?

Preg and why [^word) doesnt work?

Post by Juggernau » Fri, 27 May 2005 09:40:43


Hi
I was trying to write a script to replace some text inside some tags.

Lets say I had <tag stuff=stuff><tag stuff=otherstuff><another>

I wanted it to find all the <tag and remove them.

So I tried to write it so that it would go forward until it reached
[<^another] came. But when I tried that it would respond to another as
single characters and not as the word.

How can I do this with regular expressions, matching up against words using
[^ ] ?

I know I can do what Im trying to do other ways, but when it didnt work with
[^ ], it got me thinking about how to do it that way. Because there might
come other times when I want to 'NOT' against a word, and there has to be a
way of doing this with Regular expressions?

Thanks for any help you can give me.