开发者

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

开发者 https://www.devze.com 2022-12-19 00:36 出处:网络
Q-1. match url t开发者_运维技巧hat doesn\'t contain asp, apsx, css, htm.html,jpg, Q-2. match url that doesn\'t end withasp, apsx, css, htm.html,jpg,You want to use the \'matches count\' function, and

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

精彩评论

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