-1

I am trying to build regex pattern but the string doesn't take single double quotes.

this is the pattern and it crashes when I add \"

@"(?<\"|\'|\“)(?'first'{0}\s(?'middle'{0}{1}{2}"
mathinvalidnik
  • 1,566
  • 10
  • 35
  • 57

1 Answers1

1

In an @ string literal, you need to use "" to escape double quotes:

@"(?<\""|\'|\“)(?'first'{0}\s(?'middle'{0}{1}{2}"
JLRishe
  • 99,490
  • 19
  • 131
  • 169
  • But I don't need both opening and closing. I need only one of them because this is what I am aiming in my Regex template. – mathinvalidnik Nov 20 '14 at 15:44
  • That is not an opening and closing quote. That string there only contains one double-quote character, which is escaped. – JLRishe Nov 20 '14 at 16:07