>public static Regex XMLRegex = new Regex(@"<(?<field>[^/>]+)>(?<data>.*)</\k<field>>", RegexOptions.Compiled | RegexOptions.Singleline);>
>MatchCollection matches = XMLRegex.Matches(tcSQML); > foreach (Match m in matches) > { > if (!tDictionary.ContainsKey(m.Groups["field"].ToString())) > tDictionary.Add(m.Groups["field"].ToString(), m.Groups["data"].ToString().Trim()); > }>
><func>appendrecs</func><tcoperator>ADMIN</tcoperator> ><tcrecorddata>CHARGEDATE0001902/28/2019 00:00:00SALE_TEXT 00429<func>PaymentPlanCharge</func><orig_amount>125</orig_amount>SALESPOINT00006DANAIITRANSTYPE 000010</tcrecorddata> ><tcsalespoint>DANAII032001</tcsalespoint><tctablename>WW_SALES</tctablename> > >>
public static Regex XMLRegex = new Regex(@"<(?<field>[^/>]+)>(?<data>.*?)</\k<field>>", RegexOptions.Compiled | RegexOptions.Singleline);the result then becomes
<func>appendrecs</func> <tcoperator>ADMIN</tcoperator> <tcrecorddata>CHARGEDATE0001902/28/2019 00:00:00SALE_TEXT 00429<func>PaymentPlanCharge</func><orig_amount>125</orig_amount>SALESPOINT00006DANAIITRANSTYPE 000010</tcrecorddata> <tcsalespoint>DANAII032001</tcsalespoint> <tctablename>WW_SALES</tctablename>