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
In reply to Re^2: Zero-width look-ahead regexp question
by Hue-Bond
in thread Zero-width look-ahead regexp question
by rovf
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |