开发者

Regex mid-string pattern exclustion

I need help with a regular expression for use with UrlRewriting.Net. I have two URLs -

http://domain/SomeFolder/tracks/SomeFileName/

and

http://domain/SomeFolder/<could be anything>/SomeFileName/

For URL rewriting purposes I need to come up with one expression that will let me target specifically the URL with "tracks" in the middle of it. I need another expression to catch everything without "tracks" in it.

Before I had this constraint I was using ^~/SomeFolder/([^/]*)/SomeFileName/?$ and that worked as my catch-all. Now that I have this specific "tracks" folder, I can't use t开发者_C百科he catch all.

Make sense?

Many thanks for the help!


^~/SomeFolder/(?!tracks/)([^/]*)/SomeFileName/?$

and

^~/SomeFolder/(tracks)/SomeFileName/?$
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜