views:

61

answers:

3

Q-1. match url that doesn't contain asp, apsx, css, htm.html,jpg,

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

A: 

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)$.

Max Shawabkeh
A: 

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

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

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)

mrwayne