using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"^(?P<unit_type>SFE)(?P<unit_size>100|80|63|50|40|32|25)(?P<mounting_type>P|Z)(?P<decompression_feature>0)(?P<sep_1>-)(?P<unit_series>1X)(?P<sep_2>/)(?P<seal_material>M)(?P<additional_details>(.|[0-9])*)$";
string input = @"SFE50Z0-1X/M
SFE32P0-1X/M
SFE32Z0-1X/M
SFE25Z0-1X/M
SFE50P0-1X/M
SFE40P0-1X/M
SFE63P0-1X/M
SFE63Z0-1X/M
SFE80Z0-1X/M
SFE40Z0-1X/M
SFE25P0-1X/M
SFE100Z0-1X/M
SFE80P0-1X/M
SFE100P0-1X/M
";
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