beyondgrep / ack2

**ack 2 is no longer being maintained. ack 3 is the latest version.**
https://github.com/beyondgrep/ack3/
Other
1.48k stars 138 forks source link

Repeated capture group only highlights last instance #681

Closed creallfluharty closed 5 years ago

creallfluharty commented 5 years ago

Assuming I have the file

$ cat myfile.txt
the quick brown fox jumps over the lazy dog

Running

$ ack '([a-z]{2}){2}' myfile.txt

Produces

the qui(ck) br(ow)n fox ju(mp)s ov(er) the la(zy) dog

Where the characters in parenthesis are highlighted.

This (seems to) contrasts with the behavior of

$ ack -o '([a-z]{2}){2}' myfile.txt
quic
brow
jump
over
lazy

Is this expected behavior? If so, is there any way to highlight all 4 letters?

creallfluharty commented 5 years ago

Just looking through the issues, this looks similar to https://github.com/beyondgrep/ack2/issues/678 in the sense that ack seems to make the right match (as show by -o), but that the highlighting is only applied to a subset of the match.

Is this something which is fixed in ack3? (And on that note, when will ack3 be available in apt? [Not that I have anything against compiling, but it makes it easier when helping others])

petdance commented 5 years ago

This behavior is fixed in ack 3. In fact, it's one of the reasons that ack 3 exists. Sorry about the inconvenience.

ack 3 is available right now. https://github.com/beyondgrep/ack3 I can't tell you when it will be available in apt because I don't have anything to do with the packaging.

creallfluharty commented 5 years ago

Thanks for the confirmation! I'll probably end up switching soon then. Thanks for all that you guys do!