nishant
nishant

Reputation: 1

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

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,

Upvotes: 0

Views: 622

Answers (3)

mrwayne
mrwayne

Reputation: 637

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)

Upvotes: 1

Gumbo
Gumbo

Reputation: 655229

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

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

Upvotes: 0

Max Shawabkeh
Max Shawabkeh

Reputation: 38603

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

Upvotes: 0

Related Questions