2014-09-25 84 views
0

我想寫一個規則,拿起第二塞不匹配「結果」,然後重寫的URLWeb配置重寫規則

這裏是我到目前爲止的任何URL。

<rule name="accommidationRewrite2" enabled="true" stopProcessing="true"> 
    <match url="/accommodation/(!results)/(.*)" /> 
    <action type="Rewrite" url="/accommodation/results/params/location/{R:2}" /> 
</rule> 

你能看到我在做什麼錯嗎?

回答

0
\/accommodation\/(?!results).*?\/(.*) 

嘗試用您正則表達式這一信息。問題是,向前看符號不消耗string.So您正則表達式得到了有效匹配兩段/。看到演示。

http://regex101.com/r/qC9cH4/20

+0

謝謝,這有助於很多。這裏是我結束了 2014-09-25 16:29:10