in reply to Re: Can't match negated words.
in thread Can't match negated words.
Regexes match from left to right. So, if you first say "match /*", and then say, "don't match throw", it's *not* going to exclude "/*"'s that are preceeded with "throw". In fact, you haven't given any requirements for what should preceed "/*".
Ignoring the fact that you don't specify what should happen on a line like this:
you might want to use something like:/* throw /*
although that can probably be optimized (and the more you know about where you are going to match against, the more possibilities for optimizing there are).m!^(?:(?!throw).)*/[*]!s
Abigail
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Can't match negated words.
by perlgags78 (Acolyte) on Jun 24, 2004 at 15:29 UTC | |
by Abigail-II (Bishop) on Jun 24, 2004 at 16:03 UTC |
In Section
Seekers of Perl Wisdom