-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Obvious match missing from results when using group: a(.*c) does not match abc #1064
Comments
Interestingly enough this also fails: |
Ug. This looks like a bug in ripgrep's inner literal extractor. It thinks
I diagnosed this from the
I would have thought this was a regression since I touched this code as part of libripgrep work, but 0.9.0 exhibits the same bug. |
checking out ripgrep 0.0.1 (with |
It seems the inner literal detector fails spectacularly in cases of concatenations that involve groups. The issue here is that if the prefix of a group inside a concatenation can match the empty string, then any literals generated to that point in the concatenation need to be cut such that they are never extended. The detector isn't really built to handle this case, so we just act conservative cut literals whenever we see a sub-group. This may make some regexes slower, but the inner literal detector already misses plenty of cases. Literal detection (including in the regex engine) is a key component that needs to be completely rethought at some point. Fixes #1064
It seems the inner literal detector fails spectacularly in cases of concatenations that involve groups. The issue here is that if the prefix of a group inside a concatenation can match the empty string, then any literals generated to that point in the concatenation need to be cut such that they are never extended. The detector isn't really built to handle this case, so we just act conservative cut literals whenever we see a sub-group. This may make some regexes slower, but the inner literal detector already misses plenty of cases. Literal detection (including in the regex engine) is a key component that needs to be completely rethought at some point. Fixes #1064
What version of ripgrep are you using?
ripgrep 0.10.0
-SIMD -AVX (compiled)
+SIMD +AVX (runtime)
Bug
Example:
echo abc | rg --debug 'a(.*c)'
doesn't find any results. The following all work:
echo ac | rg 'a(.*c)'
echo abc | rg 'a.*c'
echo abc | ag 'a(.*c)'
echo abc | grep 'a\(.*c\)'
The text was updated successfully, but these errors were encountered: