the_silver_searcher icon indicating copy to clipboard operation
the_silver_searcher copied to clipboard

Add --invert-file-search-regex flag

Open alecbz opened this issue 7 years ago • 2 comments

Just like --invert-match can be used to find words not matching a pattern, there should a flag that acts like the inverse of --file-search-regex, so that:

$ ag foobar --invert-file-search-regex baz

finds all files containing foobar whose filenames do not contain baz.

alecbz avatar Aug 12 '17 00:08 alecbz

Less useful I think, but also potentially of interest, may be --invert-filename-pattern, which would print all filenames not matching a given pattern.

alecbz avatar Sep 09 '17 21:09 alecbz

Since I found this whilst looking for this capability, it's worth pointing out that --ignore exists - see https://github.com/ggreer/the_silver_searcher/issues/1084#issuecomment-308263396 for more detail

benjie avatar Jun 28 '23 08:06 benjie