2016-03-02 237 views
0

我有這些文件夾有子文件夾在其中...AG:搜索所有文件夾除了文件夾名稱/子文件夾(Perl的正則表達式)

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

我想銀色搜索者忽略locales/*除了locales/US/en/*(基本上我只關心US/en區域設置文件)

這工作,但它並沒有顯示在根目錄下的其他文件夾(公共和測試):
ag -l -G '(locales)/(US)'

我相信AG使用Perl Regexes。有什麼想法嗎?

+0

是不是這真的是一個重複http://stackoverflow.com/questions/37037307/expand-command-line-exclude-pattern-with-zsh/37056810#37056810 – gregory

回答

0

如果是Perl的正則表達式中,這應該給你預期的結果:

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

說明:

^ = 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 
+0

看起來不起作用。 –

相關問題