using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"^[A|C][1-9|A-HJ-PR-UW-Y][0-9][1-9|A-C][1-9|A-HJ-PR-UW-Y][0-9|A-HJ-PR-UW-Y]{3}[A-HJ-PR-UW-Y]{2}";
string input = @"A131K062CE04
A131K062CA04
A131K062CA
A131K062CE
A131K062CE
AZ31K062CE04
A136P099BH
A136Q09YBK
A136S02QCE
A136R09QAY
A136F04QBV
A136F08QAB
C136Q03UAU
A136D05BCG
A136B041AQ";
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