开发者

IIS 7 URL rewrite regular expression

开发者 https://www.devze.com 2023-04-10 00:36 出处:网络
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.

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

精彩评论

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