The word boundary does not help, because for instance 'FOOBAR X' and 'FOOBARX' are both strings which should be accepted (because both BAR X and BARX are considered different from <BAR>), while 'FOOBAR' should be rejected.
Actually I meanwhile believe to having found a solution to my problem while having lunch (it is surprising how a glass of Italian Chardonnay can do good to the brain cells):
so unless someone can find a flaw with this (the examples where I tried it, worked so far), I think I will stick with it. It is not a beautiful solution, though, because if I would like one day to pick up what is to the right of FOO, I can't do it. So I'm still interested in hearing alternative proposals.$name =~ /^FOO(?!(BAR|BAZ)$)/
Maybe just to make it clear, here are concrete examples: The following strings should be accepted:
while the following should be rejected:FOOABC FOO_BAR FOOBA FOOBAZZZZ FOOBAR BAZ
FOOBAR FOOBAZ BARBAZ
In reply to Re^3: Zero-width look-ahead regexp question
by rovf
in thread Zero-width look-ahead regexp question
by rovf
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |