开发者

How can I match all images without thumb image using regexp

开发者 https://www.devze.com 2023-01-28 17:31 出处:网络
How can I match all images without thumb image using regexp ? hi.gif开发者_C百科 thumb.gif hello.gif

How can I match all images without thumb image using regexp ?

hi.gif开发者_C百科
thumb.gif
hello.gif

Result should be :

hi.gif
hello.gif

I am using .+(gif|GIF|jpg|JPG) to match all images


You can use -ve lookahead assertion as:

^(?!thumb).+\.(?:gif|GIF|jpg|JPG)$

Rubular link

Regexr link


Put a negative look-ahead at the start:

(?!thumb\.).+(gif|GIF|jpg|JPG)


You can use this regex:

.+(?<!^thumb)\..+$

Also add options Multiline.

0

精彩评论

暂无评论...
验证码 换一张
取 消