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

Matching context with new lines in the regex doesn't work #522

Closed
nowox opened this issue Jan 27, 2015 · 2 comments
Closed

Matching context with new lines in the regex doesn't work #522

nowox opened this issue Jan 27, 2015 · 2 comments
Labels

Comments

@nowox
Copy link

nowox commented Jan 27, 2015

Inside the latest Ack2 repository I search for this:

 $ ack "current\ndirectory.*then" 
 249:Search for PATTERN in each source file in the tree from the current
 directory on down. If any files or directories are specified, then

But if I search the same with the context:

 $ ack -A2 "current\ndirectory.*then" 
 $ 

I don't see anything. This is because the way ack parse files. It does parse the file iterating lines when context is enabled and the whole file else. No exception is handled here. This is a bug.

@hoelzro hoelzro added the bug label Jan 27, 2015
@hoelzro
Copy link
Collaborator

hoelzro commented Jan 27, 2015

This is definitely a bug; both in the inconsistency in operation between two modes that should be consistent, but also in your first example. Ack is line-based (see Can I do multi-line regexes? in the FAQ), but we read the file into a single chunk sometimes for optimization purposes.

hoelzro added a commit that referenced this issue Jan 28, 2015
hoelzro added a commit that referenced this issue Feb 2, 2015
@hoelzro
Copy link
Collaborator

hoelzro commented Feb 2, 2015

Ok, this is fixed in dev now. Thanks for the report!

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

No branches or pull requests

2 participants