Skip to content
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

ack not matching as grep -E #678

Closed
viniciusban opened this issue Mar 17, 2019 · 3 comments
Closed

ack not matching as grep -E #678

viniciusban opened this issue Mar 17, 2019 · 3 comments

Comments

@viniciusban
Copy link

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
Copy link
Collaborator

petdance commented Mar 17, 2019

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
Copy link
Collaborator

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
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants