using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"^(?P<operating_pressure>H)(?P<sep_1>-)(?P<number_of_main_ports>4)(?P<unit_type>W)(?P<actuation_type>EH|H)(?P<unit_size>62)(?P<spool_feedback_main_stage>H|)(?P<spool_symbol>C|D|K|Z|E|F|G|H|J|L|M|Q|R|S|T|U|V|W)(?P<unit_series>5X)(?P<mounting_type>F|)(?P<sep_2>/)(?P<spool_feedback>OF|O)(?P<pilot_valve>10)(?P<type_of_solenoid>A|L)(?P<solenoid_in_ac_or_dc_version>G|W)(?P<voltage_of_solenoid>220|195|180|127|120|110|96|60|42|24|12)(?P<voltage_rectifier>R|-|)(?P<manual_override_unit>Y|)(?P<spool_position_monitoring>Y|)(?P<unit_for_time_adjustment>S2|S|)(?P<electrical_connection>Z5L|Z2L|Z1L|DKL|DZL|DL|DZ|DK|ZL|KL|Z5|Z4|Z2|Z1|D|L|Z|K|)(?P<sep_3>/)(?P<additional_equipment>17|16|15|14|13|12|11|10)(?P<orifice_positon>B|)(?P<orifice_diameter>15|12|11|10|08|)(?P<seal_material>V|)(?P<additional_details>)$
";
string input = @"H-4WEH62HE5XF/10EG24N9S2K4
H-4WEH62HD5XF/OF10EG220N9SK4/B10V
H-4WEH62HH5XF/10EG24N9K4
";
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