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
The DFA can't produce captures, but is still faster
than the Pike VM NFA, so the normal approach to finding
capture groups is to look for the entire match with the
DFA and then run the NFA on the substring of the input
that matched. In cases where the regex in anchored, the
match always starts at the beginning of the input, so
there is never any point to trying the DFA first.
The DFA can still be useful for rejecting inputs which
are not in the language of the regular expression, but
anchored regex with capture groups are most commonly
used in a parsing context, so it seems like a fair trade-off.
For a more in depth discussion see github issue #348.
0 commit comments