// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace E { public class Program { public static void Main(string[] args) { string txt = "(A)1234567890(B)12345678.9(C)12345678 (D) (E)123456 "; Dictionary res = new Dictionary(); foreach(Match m in Regex.Matches(txt, @"\(([A-Z])\)([0-9. ]+)")) { res.Add(m.Groups[1].Value, m.Groups[2].Value); Console.WriteLine(m.Groups[1].Value + " = |" + m.Groups[2].Value + "|"); } } } }