我正在尝试编写一个 glob 来匹配所有文件,排除两个目录:
app/home
和node_modules/package1
/test/app/home
/test/app/list
/test/app/Test1
/test/app/Test2
/test/app/Test3
/test/node_modules/package1
/test/a/home
/test/b/package1
**/!(home|package1)
可以很好地排除 home
和 package1
Link
我想要类似
**/!(app/home|node_modules/package1)
的东西,但它不匹配任何东西
您可以通过更改我们的排除模式以仅包含排除模式中不同的部分来匹配多个文件。
而不是
**/!(app/home|node_modules/package1)
尝试
**/app/!(home|node_modules)/package1