I am new in writing regular expression and I have the following Scenario.
I have a string, like :
string line = "if (true){var data = string.Format(\"something {0} {1}.\", \"is\", \"wrong\");}";
now I need to write a regular expression that just pick the closing curly braces which are not in the double quote
so far I tried this:
"(^(\"[^\"]*\")(}))+"
- ^(\"[^\"]*\") : I want to Ignore any substring which is inside double quote, AND
- (}) : I want to take }
- +: for at least 1 occurrence.
But it seems I Did something wrong. Could any one please guide me to sort out where I did the wrong?
Thank you.