NOTEI think it's actually look-behind assertion he needs.
output 2001:504:0:4::6181:1 If that is the output the OP wanted.
Because with "negative look-behind assertion", the match is not successful (failed). In fact, there is no output.
Checked with use re 'debug';
.. produces ..
Compiling REx `(?<!use )neighbor[[:alpha:]-]* ([[:alnum:]\.-:]+)' size 42 Got 340 bytes for offset annotations. first at 1 1: UNLESSM[-4](7) 3: EXACT <use >(5) 5: SUCCEED(0) 6: TAIL(7) 7: EXACT <neighbor>(10) 10: STAR(23) 11: ANYOF[\-A-Za-z+utf8::IsAlpha](0) 23: EXACT < >(25) 25: OPEN1(27) 27: PLUS(40) 28: ANYOF[.-:A-Za-z+utf8::IsAlnum](0) 40: CLOSE1(42) 42: END(0) anchored `neighbor' at 0 floating ` ' at 8..2147483647 (checking ancho +red) minlen 10 Offsets: [42] 8[4] 0[0] 5[4] 0[0] 8[0] 8[0] 10[8] 0[0] 0[0] 30[12] 18[12] 0[0] 0 +[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 31[1] 0[0] 32[1] 0[0 +] 48[15] 33[15] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0 +] 49[1] 0[0] 50[0] Guessing start of match, REx `(?<!use )neighbor[[:alpha:]-]* ([[:alnum +:]\.-:]+)' against `use neighbor 2001:504:0:4::6181:1'... Found anchored substr `neighbor' at offset 4... Found floating substr ` ' at offset 12... Starting position does not contradict /^/m... Guessed: match at offset 4 Matching REx `(?<!use )neighbor[[:alpha:]-]* ([[:alnum:]\.-:]+)' again +st `neighbor 2001:504:0:4::6181:1' Setting an EVAL scope, savestack=5 4 <use > <neighbor> | 1: UNLESSM[-4] 0 <> <use neighbor> | 3: EXACT <use > 4 <use > <neighbor> | 5: SUCCEED could match... failed... Match failed Freeing REx: `"(?<!use )neighbor[[:alpha:]-]* ([[:alnum:]\\.-:]+)"'
In reply to Re^2: Quick Regex trouble
by 2teez
in thread Quick Regex trouble
by jrvd
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |