Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backreferences in ignore-cases regexps are not resolved correctly #25

Closed
RunDevelopment opened this issue Mar 8, 2021 · 0 comments
Closed
Labels
bug Something isn't working

Comments

@RunDevelopment
Copy link
Owner

Right now, /(a)\1/i is resolved as /aa|AA/. This is incorrect. Proof:

> /(a)\1/i.exec("aA")
[ 'aA', 'a', index: 0, input: 'aA', groups: undefined ]

The correct resolved regex is /aa/i.

Other examples:

  • /(a|b)\1/i -> /aa|bb/i == /AA|BB/i == /[Aa][Aa]|[Bb][Bb]/i
  • /([ab-])\1/i -> /AA|BB|--/i

This bug only affects ignore-case regexps.

@RunDevelopment RunDevelopment added the bug Something isn't working label Mar 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant