JS group names with same name
Bug Description
Duplicate capture group names are now a thing, would be nice to have them.
Reproduction steps
As seen on that page:
/(?<year>\d{4})-\d{2}|\d{2}-(?<year>\d{4})/;
Expected Outcome
Should work.
Browser
Chrome, and therefore "most browsers" :)
(But not yet in node, so not most of that world, yet.)
So as long as the groups are in different alternatives, the group name may be repeated? Or is there a more complex rule to implement for this?
That was it looks like -- that page says:
A more recent feature allows named capturing groups to share names, as long as they belong to different disjunction alternatives and cannot be matched at the same time (see browser compatibility for this).
This will be supported in the next version.
Thanks!