in reply to Re: Zero-width look-ahead regexp question
in thread Zero-width look-ahead regexp question
I would use ^FOO(?!BA[RZ]\b).*$, ie put the \b inside the look-ahead. Otherwise, only 'FOO' is matched.
$ perl -le '/^FOO(?!BA[RZ]\b).*$/ and print for qw/FOOBAR FOOBARS FOOB +AZ FOOBAZS FOOQUX FOO/' FOOBARS FOOBAZS FOOQUX FOO
Update: added example
--
David Serrano
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Zero-width look-ahead regexp question
by rovf (Priest) on Jul 01, 2008 at 12:10 UTC | |
by ww (Archbishop) on Jul 02, 2008 at 03:25 UTC | |
by rovf (Priest) on Jul 02, 2008 at 07:02 UTC |