Open masukomi opened 4 years ago
Positive lookbehind: (?<=Y)X, matches X, but only if there’s Y before it. Negative lookbehind: (?<!Y)X, matches X, but only if there’s no Y before it.
(?<=Y)X
X
Y
(?<!Y)X
demo: https://jianyu.io/regulex/
that demo link didn't include positive or negative lookbehind, but i fiddled with it and it looks good to me. Thanks :D
demo with positive lookbehind
demo with negative lookbehind
Positive lookbehind:
(?<=Y)X
, matchesX
, but only if there’sY
before it. Negative lookbehind:(?<!Y)X
, matchesX
, but only if there’s noY
before it.