-
Notifications
You must be signed in to change notification settings - Fork 67
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
Problem with '--color-match' when using '*' or '?' (asterisk or question mark) #342
Comments
I get the same results, including on branch Additionally, I'd have expected Greedy-optional Also, it's not Hence, I infer (hypothesize) that what is killing the color/highlight is that the pattern can match 0 characters, so 0 are what are colorized? Perhaps the highlighting code's use of the Pattern needs to be forced greedy if it ends with an optional quantifier that is not explicitly greedy or non-greedy quantifier-modifier. |
This is arguably (almost) correct behavior. What would be more correct is if did highlight the longest match of an explicitly greedy RE that could still match 0 chars. Failing to do that is still a bug even if the original example is correct behavior. |
alternative hypothesis refuted - It is not the case that a null sequence has been (almost correctly) VT100 highlighted; there is not an empty highlighted string |
Let's simplify this a bit:
None of the results lines are colored. We would expect that on the first line where there is no |
Is it possible the zero-width first match is triggering last if $match_length <= 0;
|
Take this simple file "test.txt" :
And this simple query :
which gives me line 2/3/4 from "test.txt"
with "s " nicely colored bold-red on light-yellow.
Next query :
the same, OK.
But :
gives me 4 lines (as expected)
BUT NO COLORS
Same with :
NOTE
With egrep all queries work as expected.
(setting : export GREP_COLORS='ms=1;38;5;196;48;5;227')
BTW
RipGrep (rg) works as expected. same as egrep.
However Silver Searcher (ag) has even more complications,
but this is not the place to dive deeper in that area.
The text was updated successfully, but these errors were encountered: