public static string DoReplaceForExtraValueCode(string text, Person p) { const string RE = @"{ev:(?<name>.+?)}"; var re = new Regex(RE, RegexOptions.Singleline | RegexOptions.Multiline); var match = re.Match(text); while (match.Success) { var tag = match.Value; var name = match.Groups["name"].Value; if (p == null) { text = text.Replace(tag, ""); } else { text = text.Replace(tag, p.GetExtra(name)); } match = match.NextMatch(); } return(text); }
public static string DoReplaceForExtraValueCode(string text, Person p) { const string RE = @"{ev:(?<name>.+?)}"; var re = new Regex(RE, RegexOptions.Singleline | RegexOptions.Multiline); var match = re.Match(text); while (match.Success) { var tag = match.Value; var name = match.Groups["name"].Value; if (p == null) text = text.Replace(tag, ""); else text = text.Replace(tag, p.GetExtra(name)); match = match.NextMatch(); } return text; }