regexpp
regexpp copied to clipboard
Fixed named backreferences in strict mode
This fixes #23.
Changes:
-
countCapturingParens
now counts the number of named and unnamed groups separately. - The
_nFlag
property is now set byconsumePattern
instead ofvalidatePattern
. - 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 withstrict: true
.