Skip to content

Catch when regexp matches empty string #382

Open
@epa

Description

@epa

When the regexp passed to ack matches the empty string, this is much more likely to be a mistake than intentional. Rather than print the complete contents of every file, ack should stop with a diagnostic.

% ack ''
The regular expression matches the empty string, so would find all lines.

(If there's really a use for it, then maybe an --allow-empty flag similar to what you have in git to allow empty commits. And of course, having detected that the regexp matches the empty string, ack could go a bit faster by not bothering to match it.)

(For example I mistyped (joe|jim)? when I had meant to search for (joe|jim)@. Just to give a random example.)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions