开发者

How can I match all images without thumb image using regexp

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜