我:
<add key="IgnorePathRegex" value="^/Home/Ignore$|^/Ignore\.aspx$|^/Content/" />
我需要的值更改爲/Uploads/Logos
。目前我認爲它是/Home/Ignore/Content/
,但不完全確定。
我:
<add key="IgnorePathRegex" value="^/Home/Ignore$|^/Ignore\.aspx$|^/Content/" />
我需要的值更改爲/Uploads/Logos
。目前我認爲它是/Home/Ignore/Content/
,但不完全確定。
如果你想在/Uploads/Logos
添加到列表中:
value="^/Home/Ignore$|^/Ignore\.aspx$|^/Content/|^/Uploads/Logos$"
或者,如果你只想要/Uploads/Logos
:
value="^/Uploads/Logos$"
答案,那就是在標題的問題:你的正則表達式有幾個路徑檢查哪些是與管道或(|
)
正則表達式的說明:
^/Home/Ignore$ # Match if the entire string is /Home/Ignore
| # or
^/Ignore\.aspx$ # Match if the entire string is /Ignore.aspx
| # or
^/Content/ # Match if the string starts with /Content/
^
和$
是anchors;如果你想添加另一個選項,只需附加|
即可。
管道符號表示OR。目前你有三個完全不同的部分。你可以添加更多,如果你喜歡。 – Fattie
檢查[this reference out](http://stackoverflow.com/questions/22937618/reference-what-does-this-regex-mean) – HamZa