开发者

IIS 7 URL rewrite regular expression

Using IIS7 URL rewrite module, I am trying to get the value of a specific query string parameter, and if it exists I need to get the value of that parameter.

Example URL :

test.aspx?F5REDIRECTION&开发者_开发技巧amp;SearchType=HeaderSearch&hiddendims=&Keyword=tshirt&nkw=1&vsp=2

I need to check if "Keyword" parameter exists and I need to get the value "t-shirt".

If I test run this pattern :

^.*F5REDIRECTION&SearchType=Header.*Keyword=(.*)$

the result is "tshirt&nkw=1&vsp=2"

How do I get only "tshirt"?


Try something like this:

(?<=\?|&)Keyword=(.*?)(?=&|$)

Or if lookarounds aren't available:

(?:\?|&)Keyword=(.*?)(?:&|$)
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜