开发者

match url that doesnt contain asp, apsx, css, htm.html,jpg

Q-1. match url t开发者_运维技巧hat doesn't contain asp, apsx, css, htm.html,jpg,

Q-2. match url that doesn't end with asp, apsx, css, htm.html,jpg,


You want to use the 'matches count' function, and make it match 0.

eg. (matches all characters, then a dot, then anything that isnt aspx or css

^.*\.((aspx) | (css)){0}.*$

Edit, added ^ (start) and $ (end line chars)


Q-1. This is better done using a normal string search, but if you insist on regex: (.(?!asp|apsx|css|htm|html|jpg))*.

Q-2. This is better done using a normal string search, but if you insist on regex: .*(?<!asp|css|htm|jpg)(?<!aspx|html)$.


If your regular expression implementation does allow lookaround assertions, try these:

(?:(?!aspx?|css|html?|jpg).)*
.*$(?<!aspx?|css|html?|jpg)
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜