简体   繁体   中英

what does this regex expression mean - ^/Home/Ignore$|^/Ignore\.aspx$|^/Content/?

I have:

<add key="IgnorePathRegex" value="^/Home/Ignore$|^/Ignore\.aspx$|^/Content/" />

I need to change the value to /Uploads/Logos . At present I think it is /Home/Ignore/Content/ , but not totally sure.

Explanation of the regex:

^/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/

^ and $ are anchors ; if you want to add another option, just append it with | .

It currently matches the following:

/Home/Ignore
/Ignore.aspx
/Content/* (anything under /Context/ including /Context)

If you want to add the /Uploads/Logos into the list:

 value="^/Home/Ignore$|^/Ignore\.aspx$|^/Content/|^/Uploads/Logos$"

Or, if you want only the /Uploads/Logos :

 value="^/Uploads/Logos$"

Answer to the question that is on title: Your regex has several paths checking which are or'd with pipe( | )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM