列出模式不匹配的文件!

时间:2022-09-13 00:18:52

I use a product called Crash Plan Pro and it uses regular expressions for matching its exclude files. I need a expression to list the files in a directory where a pattern is not matched, case insensitive. What I have to date that works on a global scale is

我使用名为Crash Plan Pro的产品,它使用正则表达式来匹配其排除文件。我需要一个表达式来列出模式不匹配的目录中的文件,不区分大小写。我迄今为止在全球范围内工作的是

(?i)^((?!(/*(-cd|-cw|-cm).spi|.*/)$).)*$

But unfortunately this is not specific to the directory I need to target.

但不幸的是,这并不是我需要定位的目录所特有的。

Any help would be appreciated.

任何帮助,将不胜感激。

2 个解决方案

#1


0  

It's quite hard and clumsy to say "but not ..." using regexes. Maybe you can switch the list from "include" to "exclude"?

使用正则表达式说“但不是......”是相当困难和笨拙的。也许你可以将列表从“包含”切换到“排除”?

#2


0  

Does it support negative lookahead? If so, that's an easier way of saying "not." If it is using Java regular expressions, it definitely supports negative lookahead. If it is using another language, it might or might not.

它支持负面前瞻吗?如果是这样,这是一种更容易说“不”的方式。如果它使用Java正则表达式,它肯定支持负向前瞻。如果它使用其他语言,则可能会也可能不会。

#1


0  

It's quite hard and clumsy to say "but not ..." using regexes. Maybe you can switch the list from "include" to "exclude"?

使用正则表达式说“但不是......”是相当困难和笨拙的。也许你可以将列表从“包含”切换到“排除”?

#2


0  

Does it support negative lookahead? If so, that's an easier way of saying "not." If it is using Java regular expressions, it definitely supports negative lookahead. If it is using another language, it might or might not.

它支持负面前瞻吗?如果是这样,这是一种更容易说“不”的方式。如果它使用Java正则表达式,它肯定支持负向前瞻。如果它使用其他语言,则可能会也可能不会。