From: https://stackoverflow.com/a/959982/101055
I am trying to use:
using System.Text.RegularExpressions;
Dictionary<string, string> parameters = new Dictionary<string, string>();
parameters.Add("goodName1", "asdf");
parameters.Add("goodName2", "qwerty");
string text = "this is my {goodName1} template {goodName2} string";
text = Regex.Replace(text, "\{(.+?)\}", m => parameters[m.Groups[1].Value]);
I get 2 build errors on \{(.+?)\}
, on {
and }
exactly.
ERROR > Unrecognized escape sequence
What is wrong here?