using System; using System.Text.RegularExpressions; public class Test { public static void Main() { string line = "HELLO MYNAME IS1 = {P 111.11, O -222.22, L 333.33, L -444.44, Y 555.55}"; Regex re = new Regex(@"^HELLO MYNAME ([A-Za-z0-9]+) = {([A-Z]\s[+-]?[0-9]+.[0-9]+,?\s?)+}"); MatchCollection matchCollection = re.Matches(line); foreach(Match m in matchCollection) { Console.WriteLine("Match: "); Console.WriteLine(m.Groups[1].Value); foreach (Capture cap in m.Groups[2].Captures) Console.WriteLine($"No {cap.Index} Value: {cap.Value}"); } } }