I think it's actually look-behind assertion he needs.
I don't think so. The OP said that it should match "neighbor" but not "use neighbor", so that a zero-width negative look-behind assertion seems to be what is needed to exclude "use".
Just an additional note: the do {} block is unnecessary in the OP code. The solution could be:
($var =~/(?<!use )neighbor[[:alpha:]-]* ([[:alnum:]\.-:]+)/) and print $1;or even:
print $1 if $var =~/(?<!use )neighbor[[:alpha:]-]* ([\d:]+)/;In reply to Re^3: Quick Regex trouble
by Laurent_R
in thread Quick Regex trouble
by jrvd
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |