I have a string that contains this:
value="'+c+'"
and want to use regular expressions to get rid of the single quotes, plus signs, and anything inbetween them:
value=""
here’s what I’m trying:
responseFromServer = Regex.Replace(responseFromServer, @"=""'\+.+?\+'""", "", RegexOptions.Singleline);
solution:
responseFromServer = Regex.Replace(responseFromServer, "'[+].*[+]'", "", RegexOptions.Singleline);
Here is the expression that matches all between the
'+and+'in the given example:If you also want to match with look behind and look ahead, you can try:
which checks for
="before the match and"after the match.You can also extend this to look for the value name before the
=, which I expect changes. Depends on what exactly those value names can contain.