Reputation: 2361
I've been trying to figure out how to write this regular expression. It is to be used for ISAPI_Rewrite, a module for IIS 6, for doing URL rewriting.
I want the url /hg/<parameter>
to be mathed, so it can be rewrited to /hg/hgwebdir.cgi/<parameter>
.
I've matched it using ^/hg/(.*)
.
My problem is, if the URL /hg/hgwebdir.cgi/<parameter>
is used, the regex should NOT match. Using the above regex with this URL, will rewrite to /hg/hgwebdig.cgi/hgwebdig.cgi/<parameter>
which is not correct.
Can you help me create the matching pattern?
Upvotes: 1
Views: 1581
Reputation: 25563
You could use a negative lookahead to do this:
"^/hg/(?!hgwebdir.cgi)(.*)"
http://www.regular-expressions.info/tutorial.html is a great tutorial for regular expressions. =)
Upvotes: 3