/// <summary> /// Expand repeat patterns $[..] /// </summary> /// <param name="templateLine"></param> /// <returns></returns> private string ExpandTemplate(string templateLine) { Regex regexRepeat = new Regex(REPEATPATTERN); string newTemplateLine = templateLine; try { // repeat for every expandpattern snippet found in this line foreach (Match match in regexRepeat.Matches(templateLine)) { string variable = ExtractVariableNames(match.Groups[1].Value)[0]; // only expand template pattern for variables found in the intermediate variablelist if (intermediate.ContainsKey(variable)) { string newPart = ""; for (int i = 0; i < intermediate.NumOfValues(variable); i++) { // duplicate pattern for each occurence of value, replacing # by value indexer // patroon :# moet vervangen worden, niet # (kan deel van trsnaam zijn) newPart = newPart + (match.Groups[1].Value).Replace(":#", ':' + i.ToString()); } newTemplateLine = newTemplateLine.Replace(match.Groups[0].Value, newPart); Log.WriteLine("expanding template for " + variable); } } } catch { Log.WriteLine("WARNING expanding of variable repeat pattern failed (skipped) [" + templateLine + "]"); } return(newTemplateLine); }