beyondgrep / ack2

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

ack not matching as grep -E #678

Closed viniciusban closed 5 years ago

viniciusban commented 5 years ago

1) Extended grep: Correct

$ echo "Housebreak or Housekeep" | grep -E -e "House(break|keep)"

Result: Housebreak or Housekeep

Conclusion: Correct: "House" followed by "break" or "keep".

2) ack with non-capturing groups: Correct

$ echo "Housebreak or Housekeep" | ack "House(?:break|keep)"

Result: Housebreak or Housekeep

Conclusion: correct, as extended grep above.

3) ack with captured groups: Fail

$ echo "Housebreak or Housekeep" | ack "House(break|keep)"

Result: Housebreak or Housekeep

Conclusion: Fail. I don't want "break" or "keep" alone.

ack 2.22 on macOS 10.13.6 (High Sierra)

petdance commented 5 years ago

The matching is correct, but it's the highlighting of the match that is incorrect. This has been fixed in ack 3, which is currently in beta at https://github.com/beyondgrep/ack3.

I will probably not backport it to ack 2 because it would require a lot of rewriting how ack 2 works. I'm going to leave this ticket open as a reminder, however, in case we need to go back and fix it in ack 2 in the future.

petdance commented 5 years ago

I'm sorry, I misspoke. This bug is not going to change in ack 2. If anyone was relying on this behavior, I don't think it's good to make a change like this in a point release.

petdance commented 5 years ago

This is fixed in ack 3, and will not be addressed in ack 2.