private static string RenameTemplateParameterME(Match m, string templateCall, string newparameter)
{
// check for nested templates within the main template to avoid changing their parameter names
foreach(Match n in WikiRegexes.NestedTemplates.Matches(" " + templateCall.Substring(2)))
{
if (n.Index > 0 && m.Index >= n.Index && m.Index <= (n.Index+n.Length))
return m.Value;
}
return (m.Groups[1].Value + newparameter + m.Groups[2].Value);
}