[英]regular expression to ignore file extension pattern xxx.html vs xxx.prod.html
I have a few directories to extract files. 我有一些目录来提取文件。 I only want the
.prod
files: 我只想要
.prod
文件:
Example 例
src
- dir1
-- file1.prod.html
-- file1.html
-- file2.prod.html
-- file2.html
- dir2
-- filex.prod.html
-- filex.html
-- filen.prod.html
-- filen.html
I would like exclude all .html
(but not .prod.html
) 我想排除所有
.html
(但不排除.prod.html
)
expected results: 预期成绩:
src
- dir1
-- file1.prod.html
-- file2.prod.html
- dir2
-- filex.prod.html
-- filen.prod.html
((?!.html).prod.html$)
If you want to match strings ending on .prod.html
you don't need a lookahead: 如果要匹配以
.prod.html
结尾的字符串, .prod.html
无需先行操作:
^.+\.prod\.html$
I might be making this too simple, but since the base .html files do not contain .prod you could just key on that. 我可能使这个过程太简单了,但是由于基本.html文件不包含.prod,因此您只需键入即可。 Try:
.*\\.prod.*
尝试:
.*\\.prod.*
我认为这可以解决问题:
^((\.prod\.html)|(?!html).)*$
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.