using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"(?xi)^( (DE)?[0-9]{9}|)$";
string input = @"ATU99999999
BE0999999999
BG999999999
HR12345678901
CY99999999L
CZ12345678
DK99999999
EE123456789
FI99999999
FRXX999999999
DE999999999
EL123456789
HU12345678
IE1S23456L
IE1234567T
IE1234567TW
IE1234567FA
ESA12345678
ESZ1234567E
DE813992525";
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