`no-trivially-nested-lookaround` can change the patterns
RunDevelopment opened this issue · 1 comments
RunDevelopment commented
Description
I just learned that capturing groups inside negated lookarounds behave interestingly. The captured text of a capturing group is reset after leaving a negated lookaround.
This means that the \1 in /(?!(a))\w\1/ is useless. However, the \1 in /(?!(?!(a)))\w\1/ (double negation) is useless too.
This means that (?!(?!R) for some regex R is equivalent to (?=R) if and only if R does not contain capturing groups.
The no-trivially-nested-lookaround does not account for this right now.
RunDevelopment commented
Fixed in regexp/no-trivially-nested-assertion