using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"^(\w+) +\w+ +(?:\[[^\]]+\] *)?";
string input = @"0000 10 Text(""TOTAL,SOME RANDOM TEXT"") (1122aabb)
0010 5 D==1122aabb (1122aabb)
0015 17 Text(""AND,SOME,MORE"") (00000001)
002c 5 D==1 (1)
0031 1 !D (ccdd3344)
0032 5 D==ccdd3344 (ccdd3344)
0037 2 !1 (1)
0039 0 [AAAA] Fff
0039 1 [BBBB] Aaa
003a 6 N(05, eeff5566) (eeff5566)
0040 1 Qq
0041 2 $ab ([String]:""Unknown"")
0043 f Call A/SomeFunc-X
0052 1 cd";
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