排除资产正则表达式

exclude an asset regex

我需要编写一个正则表达式来捕获目录中除一项资产之外的所有内容。 前任。 我想排除 /test1/test2/new.jpg 并捕获 /test1/test2/

中的所有其他内容

我尝试了否定前瞻,但似乎没有用。

/test1/test2/^(?!new.jpg).*

你不需要^介于两者之间:

/test1/test2/(?!new.jpg).*

看到这个:https://regex101.com/r/uHgBZc/1