using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"^(\d{2})\s(\d.\d)\s(\w+(?:-+\w+)*(?:--\w)?-?)\s((?:\d+,)?\d+.\d+)\s((?:\d+,)?\d+.\d+)$";
string input = @"69 1.0 PKS-EKC-FlYCTRK--Y 2,110.28 2,110.28
70 2.0 ACS-PMM 31.75 63.50
72 1.0 PKS-TR1-CRD 308.14 308.14
73 1.0 QTC-01HZZ-RBER058- 1,725.57 1,725.57
74 1.0 MGS-05B-4TC-120--8 1,222.84 1,222.84
75 1.0 ACS-VGY 98.60 98.60
76 2.0 ACS-VGG 27.27 54.53
77 2.0 ACS-VGQ 110.93 221.86
78 2.0 ECS-ENM--845 1,294.18 2,588.36
80 1.0 FREIGHT 4,188.00 4,188.00
";
RegexOptions options = RegexOptions.Multiline;
foreach (Match m in Regex.Matches(input, pattern, options))
{
Console.WriteLine("'{0}' found at index {1}.", m.Value, m.Index);
}
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for C#, please visit: https://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex(v=vs.110).aspx