문제

So another question led me to wondering if there is a way to negate a regex backreference without using lookarounds? The original post is here, but the approved answer is using lookarounds. In places those are not supported, is there a clean way to handle negative backreferences? I have found on a regex site [^\x] where x is the backref. number, does not work as intended.

For example: Find a number followed directly by any other number (but dynamic in the number). It would make sense to have (\d)[^\1], but inside a character class, everything is taken literally.

도움이 되었습니까?

해결책

is a way to negate a regex backreference without using lookarounds?

No.

In theory, how are the lookarounds being generated by the regex engine?

Lookarounds are not "generated" with other simpler regex constructs, they are a distinct feature of their own.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top