Skip to content

Conversation

sjamesr
Copy link
Contributor

@sjamesr sjamesr commented Jun 2, 2020

In the past, a.*?c|a.*?b was factored to a.*?[bc]. Thus, given
"abc" as its input string, the automaton would consume "ab" and
then stop (when unanchored) whereas it should consume all of "abc"
as per leftmost semantics.

This fix is ported from Go's regex impl,
https://go-review.googlesource.com/c/go/+/18357/.

Fixes #93.

In the past, `a.*?c|a.*?b` was factored to `a.*?[bc]`. Thus, given
"abc" as its input string, the automaton would consume "ab" and
then stop (when unanchored) whereas it should consume all of "abc"
as per leftmost semantics.

This fix is ported from Go's regex impl,
https://go-review.googlesource.com/c/go/+/18357/.

Fixes google#93.
@sjamesr sjamesr merged commit 7fce527 into google:master Jun 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect match found when capturing groups are not used
2 participants