Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何使用 regexp 匹配所有没有拇指图像的图像?
hi.gif thumb.gif hello.gif
结果应该是:
hi.gif hello.gif
我.+(gif|GIF|jpg|JPG)用来匹配所有图像
.+(gif|GIF|jpg|JPG)
您可以将 -ve 前瞻断言用作:
^(?!thumb).+\.(?:gif|GIF|jpg|JPG)$
红色链接
正则表达式链接
在开始时放一个负面的前瞻:
(?!thumb\.).+(gif|GIF|jpg|JPG)
您可以使用此正则表达式:
.+(?<!^thumb)\..+$
还添加选项多行。