using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"(?:[A-Za-z0-9!#$%&'*+/=?.^_`{|}~-]+(?:.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|\""(?:[x01-x08x0bx0cx0e-x1fx21x23-x5bx5d-x7f]|[x01-x09x0bx0cx0e-x7f])*\"")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])).){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[x01-x08x0bx0cx0e-x1fx21-x5ax53-x7f]|[x01-x09x0bx0cx0e-x7f])+)])";
string input = @"""Maximilian Milde"" <max.milde@freenet.de>,<Telefonkonferenz@telefonkonferenz.de>, ""Model Woman, Petra"" <muster114@googlemail.com>, 'Sample Lady, Eva' <eva.muda@gmx.net>, ""'Sample Man, Bernhard'"" <Mustermann.bernhard@t-online.de>, ""'Sample Woman, Ute'"" <utemusterfrau@gmail.com>, ""'Sample, Gisela'"" <Giselamuster50@gmx.de>, 'Mumann, Helmut' <hemumann@googlemail.com>, ""'Mustermann, Alexander'"" <AlexanderMustermann@web.de>, ""'Muster, Vera'"" <v.muster@web.de>, ""'sample woman, Sandra"" <sandra.Musterfrau@gmx.net>, ""'Schubert, Ina"" <inas31@gmx.de, Seitz, Irmtraud, Irmtraud.s.e@googlemail.com, Kutz, Holger, Claudia Krüger, Milde, F... Mannheim";
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