Regex: (?<!xx)(?<=34)56(?=78) with global flag
12345678
xx345678
Why does it match 56 on both lines? Shouldn't (?<!xx) exclude second line?
You can use this regex with a nested negative lookbehind:
(?<=(?<!xx)34)56(?=78)
(?<!xx)
inside the (?<=(?<!xx)34)
will assert failure if xx
is positioned just before 34
.