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}");
}
}
}
dXNpbmcgU3lzdGVtOwp1c2luZyBTeXN0ZW0uVGV4dC5SZWd1bGFyRXhwcmVzc2lvbnM7CgpwdWJsaWMgY2xhc3MgVGVzdAp7CglwdWJsaWMgc3RhdGljIHZvaWQgTWFpbigpCgl7CgkJc3RyaW5nIGxpbmUgPSAiSEVMTE8gTVlOQU1FIElTMSA9IHtQIDExMS4xMSwgTyAtMjIyLjIyLCBMIDMzMy4zMywgTCAtNDQ0LjQ0LCBZIDU1NS41NX0iOwoJCVJlZ2V4IHJlID0gbmV3IFJlZ2V4KEAiXkhFTExPIE1ZTkFNRSAoW0EtWmEtejAtOV0rKSA9IHsoW0EtWl1cc1srLV0/WzAtOV0rLlswLTldKyw/XHM/KSt9Iik7CgkJTWF0Y2hDb2xsZWN0aW9uIG1hdGNoQ29sbGVjdGlvbiA9IHJlLk1hdGNoZXMobGluZSk7CgkJZm9yZWFjaChNYXRjaCBtIGluIG1hdGNoQ29sbGVjdGlvbikKCQl7CgkJICAgIENvbnNvbGUuV3JpdGVMaW5lKCJNYXRjaDogIik7CgkJICAgIENvbnNvbGUuV3JpdGVMaW5lKG0uR3JvdXBzWzFdLlZhbHVlKTsKCQkgICAgZm9yZWFjaCAoQ2FwdHVyZSBjYXAgaW4gbS5Hcm91cHNbMl0uQ2FwdHVyZXMpCgkJICAgICAgICBDb25zb2xlLldyaXRlTGluZSgkIk5vIHtjYXAuSW5kZXh9IFZhbHVlOiB7Y2FwLlZhbHVlfSIpOwoJCSB9Cgl9Cn0=