public static string ParseString(string input) { Regex replacements = new Regex(@"\$\{([^\}]+)\}"); MatchCollection matches = replacements.Matches(input); foreach (Match match in matches) { input = input.Replace(match.Value, GetByName(match.Groups[1].Value)); } return input; }