L
lmeurs
Dear all,
I'm sure the subject sounds more complicated than the actual matter.
Let me explain my problem. With Perl regular expressions one can
define a character and negated character classes.
s/[abc]//g The letters a, b and c will be removed from a
string
s/[^abc]//g Now all the letters *but* a, b and c will be
removed from a string
One can also do the first with strings, like this:
s/(one|two|three)//g Substrings 'one', 'two' and 'three' will be
removed from a string
But how can I turn this around, just like I did with character
classes? What I'm looking for would look something like this:
s/(^one|two|three)//g or s/!(one|two|three)//g
Why? I am trying to get rid of all HTML-tags *but* break-, paragraph-
and divider-tags.
s/<\/?(br|p|div)( .+?)?>//ig This would remove the break-,
paragraph- and divider-tags from a string
How can I invert this regular expression? Any help would be really
appreciated!
Thanks a lot in advance,
Laurens Meurs
Rotterdam, the Netherlands
I'm sure the subject sounds more complicated than the actual matter.
Let me explain my problem. With Perl regular expressions one can
define a character and negated character classes.
s/[abc]//g The letters a, b and c will be removed from a
string
s/[^abc]//g Now all the letters *but* a, b and c will be
removed from a string
One can also do the first with strings, like this:
s/(one|two|three)//g Substrings 'one', 'two' and 'three' will be
removed from a string
But how can I turn this around, just like I did with character
classes? What I'm looking for would look something like this:
s/(^one|two|three)//g or s/!(one|two|three)//g
Why? I am trying to get rid of all HTML-tags *but* break-, paragraph-
and divider-tags.
s/<\/?(br|p|div)( .+?)?>//ig This would remove the break-,
paragraph- and divider-tags from a string
How can I invert this regular expression? Any help would be really
appreciated!
Thanks a lot in advance,
Laurens Meurs
Rotterdam, the Netherlands