Negative lookahead, Negative lookbehind

Advanced Renamer forum
#1 : 21/01-21 20:12
Tommy
Posts: 2
Negative lookahead, Negative lookbehind, Are these regex functions supported?
#2 : 21/01-21 23:55
David Lee
Posts: 1125
Reply to #1:
Lookahead is supported by PCRE but not lookbehind.

However there is a workaround - the meta-character "\K" is an indication to exclude the characters already matched from the final match.

So the regex "abc\Kdef" will match "def" but only if it is immediately preceded by "abc"

Likewise for the negative version: "(^|[^(abc)]\K)def"

edited: 22/01-21 10:43