using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"^record(?<id>\d+),[0-9\#\$\%\-\+\,]+,(?<name>\w+),[\D\,]+,(?<PostalCode>\d+),[0-9\#\$\%\-\+\,]+,(?<Status>(true|false)),End$";
string input = @"record18,$65535,sisoog,do,5463213,33436,12,18,-17,+16,78,trUe,End
record15,#15,25,45,sisoog,s,is,oog,5463213,6,-7,78,33-43,True,End
record16,55,-35,sisoog,End,use,wait,546365213,#88,15,5485,False,End
record17,15,-45,351,sisoog,do,wait,smit,5463213,33-436,faLse,End
record17,15,-45,351,sisoog,do,smit,5463213,3436,End";
RegexOptions options = RegexOptions.Multiline | RegexOptions.IgnoreCase;
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