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

Fixed named backreferences in strict mode #24

Closed
wants to merge 1 commit into from
Closed

Fixed named backreferences in strict mode #24

wants to merge 1 commit into from

Conversation

RunDevelopment
Copy link

This fixes #23.

Changes:

  • countCapturingParens now counts the number of named and unnamed groups separately.
  • The _nFlag property is now set by consumePattern instead of validatePattern.
  • Patterns are now validated in a single pass (after the initial counting of all capturing groups).
  • Added two new test files to verify the fix. The regexes in these test files are the ones from test/fixtures/parser/literal/named-capturing-group-valid-2018.json. I simply copied the file and divided the patterns based on whether they are valid with strict: true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: Named backreferences will always cause a syntax error for non-Unicode regexes in strict parsing mode
2 participants