Asp.net URL重写问题,正则表达式

Asp.net URL重写问题,正则表达式,asp.net,regex,url-rewriting,Asp.net,Regex,Url Rewriting,在我的应用程序中,我使用Intelligencia重写URL。 我的URL模式是 <rewrite url="~/([A-Za-z0-9-_ ]+)$" to="~/xxxxxx.aspx?id=$1"/> 现在我想,如果URL不包含iphonestatelist、iphonepropertytype,那么只有它应该重定向 我使用了下面的代码,但它不工作 <rewrite url="~/(^((?!\b(iphonestatelist|iphonepropertytype

在我的应用程序中,我使用Intelligencia重写URL。 我的URL模式是

<rewrite url="~/([A-Za-z0-9-_ ]+)$" to="~/xxxxxx.aspx?id=$1"/>

现在我想,如果URL不包含iphonestatelist、iphonepropertytype,那么只有它应该重定向

我使用了下面的代码,但它不工作

<rewrite url="~/(^((?!\b(iphonestatelist|iphonepropertytype)\b).)*[A-Za-z0-9-_ ]+)$" to="~/xxxxxx.aspx?id=$1"/>

例如: 下面的URL不想重写

www.xxxx.com/abc/sef/iphonestatelist

要重写的正确URL

www.xxxx.com/FX1234试试看

<rewrite
   url="^(?!.*?\b(?:iphonestatelist|iphonepropertytype)\b)~/([A-Za-z0-9-_ ]+)$" 
   to="~/xxxxxx.aspx?id=$1"
/>


一般情况下:要检查字符串是否包含(或不包含)某个子字符串,请使用如下的前瞻(或负前瞻):

^(?=.*?pattern-reqired)pattern-you-look-for ^(?!.*?pattern-disallowed)pattern-you-look-for
`^(?=.*?pattern-reqired)pattern-you-look-for
^(?=.*pattern Required)您要查找的模式 ^(?!*?不允许的模式)您要查找的模式 这些模式也可以链接起来

^(?!.*?not-this)(?!.*?not-that)pattern-you-look-for ^(?!*?不是这个(?!*?不是那个)你要找的图案 试一试

一般情况下:要检查字符串是否包含(或不包含)某个子字符串,请使用如下的前瞻(或负前瞻):

^(?=.*?pattern-reqired)pattern-you-look-for ^(?!.*?pattern-disallowed)pattern-you-look-for
`^(?=.*?pattern-reqired)pattern-you-look-for
^(?!*?不允许的模式)您要查找的模式 这些模式也可以链接起来

^(?!.*?not-this)(?!.*?not-that)pattern-you-look-for ^(?!?不是这个(?!?不是那个)你要找的图案`