-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
--only-matching
only prints first match of matched line N times
#451
Comments
Here's a much simpler example:
@s3rb31 if you want to take a stab it, I believe the bug is here: https://github.com/BurntSushi/ripgrep/blob/master/src/printer.rs#L311 Instead of running the regex again, it should use the original match data to get the start & end. |
The column is ok, while data is not:
|
Sorry for the bug 😭 |
Oh, this was really quick. Thanks for the fix! I compiled it and it performs well and solid until now. Will report back if I encounter more bugs. Thanks again! |
Take this file as test data. If I do the following with good old
grep
:grep -Po "\/get\/v\/\d*" fgi.txt
I get the following result:
But if I try to achive the same result with rg:
rg -o "/get/v/\d*" fgi.txt -N
I think that behaviour ist really odd and cannot be intended. If I am not mistaken this also violates the documentation (manpage):
But it does not print all the parts. It just prints the first match N times, where N is actually the correct number of matched parts.
I hope this can get fixed. I may create a PR myself if it is not too complicated and someone can lead me the right direction.
Greetings
The text was updated successfully, but these errors were encountered: