You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixscala-js#3134: Make regex.Matcher report correct group positions.
To compute the correct group positions (which are not computed by javascript),
GroupStartMap modifies the regular expression so that every part of the regex
belongs to a group. Based on the length of every group, we can recover the
start position of the original group.
Example:
If the regex /A(B)\1/ matches a string at a given index,
then /(A)(B)\2/ matches the same string at the same index.
However, in the second regex, we can use the length of the first group (A)
to retrieve the start position of the second group (B).
Note that the back-references in the second regex are shifted, but this
does not change the matched strings.
0 commit comments