public static string GetTemplateArgument(string templateCall, int argument) { string pipecleanedtemplate = PipeCleanedTemplate(templateCall); int count = 1; foreach (Match m in arg.Matches(pipecleanedtemplate)) { if (count.Equals(argument)) return templateCall.Substring(m.Groups[1].Index, m.Groups[1].Length); count++; } return ""; }