-
-
Notifications
You must be signed in to change notification settings - Fork 199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RE2 - Syntax change across RE2, Go, Rust made #1588
Comments
I disagree with the expected result as far as normal regex operation goes. You have a blank alternation there which should match any position in the string. The fact that it's in a capture group also means it should capture what it matches, but it would only do so for the last iteration of its matches due to having a quantifier after it. It should never ignore 1 or more
As far as the regex itself goes, it's a bit odd to have |
The oddness of the regex isn't really in question. It's clearly a pathological case, and it's minimized from a more complex regex. I originally reported this with
No. The empty string matches at every position. So repeating it would cause an infinite repetition since there is never any advance. To be really clear: we (maintainers of Rust regex, Go regex and RE2) are changing this to a result that we believe is both correct and is also consistent with PCRE and Perl. |
I agree, which is why it was my last remark, outside of the main discussion, tried to provide alternates.
Not sure why this would be the case. Once a position is matched the "head" advances along in the string. It would however have the opportunity to become a catastrophic backtracking issue as part of a larger regex. But by itself it should not: https://regex101.com/r/YDmvwO/1
That is awesome, and thank you! |
You're talking about iteration. But within the context of a repetition, that isn't the case. The repetition is saying, "match as much of this possible." But matching an empty position means nothing is advanced. If you match The bug here is that when you try to match |
Okay I see where the misunderstanding was. We're saying the same thing but I assumed My apologies, yes, we're on the same page. |
I assume this is an implementation detail within the engine, and not my implementation. If so, I can easily recompile a newer version. |
Thanks for creating this issue, I've finally gotten around to updating it (and improving performance of the golang implementation) |
Bug Description
This is being fixed by RE2, Go, and Rust
golang/go#46123
google/re2j#136
rust-lang/regex#779
Reproduction steps
Set regex101 to use "go"
Set text area to
aaa
Test
(|a)*
Test
(|a)+
Expected Outcome
Both should match `` (none)
Browser
Version 14.0.3 (16610.4.3.1.7)
OS
macOS 11.2.3 (20D91)
The text was updated successfully, but these errors were encountered: