-2

I am trying to get the text inside "" in:

_["Some text to get"]

So I tried the following in C#:

Regex pattern = new Regex(@"_\["(.*?)\"]");

This does not compile because of the " inside the regex expression.

The regex expression seems to work: https://regexr.com/3h076

How to fix this?

Miguel Moura
  • 36,732
  • 85
  • 259
  • 481

1 Answers1

0

Why not just append the inside of the regex to make a larger string

_["Some text to get"]
Regex p = new Regex(@"_\[" + " (.*?)" + "\"]");
Jimenemex
  • 3,104
  • 3
  • 24
  • 56