-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
  • 32,822
  • 74
  • 219
  • 400

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,190
  • 2
  • 18
  • 45