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
I was trying to search for IP addresses and ran into an odd problem. I tried the expression '(\d{1,3}\.){3}\d{1,3}' and found no matches. I changed from a fixed repetition of the subgroup to one or more - '(\d{1,3}\.)+\d{1,3}' - and got matches. Using the --debug flag I see that the first case looks for the wrong literal:
It's a pretty sweet bug. This is indeed a bug in ripgrep's inner literal extraction. (Over aggressive literal extraction is one of the largest sources of bugs in the regex engine too.)
If we do, this results in extracting `foofoofoo` from `(\wfoo){3}`,
which is wrong. This does prevent us from extracting `foofoofoo` from
`foo{3}`, which is unfortunate, but we miss plenty of other stuff too.
Literal extracting needs a good rethink (all the way down into the regex
engine).
FixesBurntSushi#93
I was trying to search for IP addresses and ran into an odd problem. I tried the expression
'(\d{1,3}\.){3}\d{1,3}'
and found no matches. I changed from a fixed repetition of the subgroup to one or more -'(\d{1,3}\.)+\d{1,3}'
- and got matches. Using the--debug
flag I see that the first case looks for the wrong literal:The second case only looks for a single
.
as expected.Is this a bug in the regex parsing or am I doing something wrong?
The text was updated successfully, but these errors were encountered: