0

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.

HamZa
  • 14,671
  • 11
  • 54
  • 75
SamJolly
  • 6,347
  • 13
  • 59
  • 125
  • 1
    the pipeline symbol means OR. at the moment you have three completely different sections. you could add more if you like. – Fattie Mar 29 '14 at 10:56
  • Check [this reference out](http://stackoverflow.com/questions/22937618/reference-what-does-this-regex-mean) – HamZa Apr 09 '14 at 22:16

3 Answers3

2

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 |.

Tim Pietzcker
  • 328,213
  • 58
  • 503
  • 561
2

It currently matches the following:

/Home/Ignore
/Ignore.aspx
/Content/* (anything under /Context/ including /Context)
mesutozer
  • 2,839
  • 1
  • 12
  • 13
  • Thanks. I just tried with some online testers, and they complained about "/" being unescaped, and therefore my Regex expression is not valid. Is this correct? – SamJolly Mar 29 '14 at 11:03
  • Depends on the library you are (or online tools are) using. Your regex could be valid.. – mesutozer Mar 29 '14 at 11:04
1

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(|)

Sabuj Hassan
  • 38,281
  • 14
  • 75
  • 85