0

I have these folders that have subfolders in them...

locales/US/en
locales/US/fr
locales/FR/en
locales/FR/fr
locales/DE/en
locales/DE/fr
public
test
[...]

I want Silver Searcher to ignore locales/* EXCEPT for locales/US/en/* (essentially I only care about US/en locale files)

This works, EXCEPT that it doesn't show the other folders in root (public and test):
ag -l -G '(locales)/(US)'

I believe AG uses Perl Regexes. Any thoughts?

Jamis Charles
  • 5,827
  • 8
  • 32
  • 42
  • Isn't this really a duplicate of http://stackoverflow.com/questions/37037307/expand-command-line-exclude-pattern-with-zsh/37056810#37056810 – gregory Jan 10 '17 at 21:59

1 Answers1

0

If it is perl regular expressions this should give you the expected result:

^(?:locales/US/en|(?!locales))

Explanation:

^   = anchor regular expression to start of string.
(?: = group which is not captured
|   = Alternation for alternative capture
(?! = negative look ahead assertion - ensures that the string isnt starting with locales, unless it is starting with locales/US/en
bolav
  • 6,938
  • 2
  • 18
  • 42