using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"^(((([A-Z]+-)?((\d{2})([A-Z]{3})(\d{2}))?([A-Z]{3})?( )?((.[0-9A-Z]{3})|([0-9A-Z]{2}))( )([X][\/])?((E\/)|(B\/)|(T\/)|(L\/))*(([A-Z][\/-])?[A-Z]{3})?(?!\d{1,3}[A-Z\s])( )?(((E\/XXX)?|([Q]{1}(( )?([A-Z]{3})([A-Z]{3}))?(\d+M)?(\d{1,6}(\.\d{1,4})?))?|(M( )?([A-Z]{6})?( )?(\d{1,6}(\.\d{1,4})?)?)?|([R]{1}(\d+M)?(\d{1,6}(\.\d{1,4})?))?|(([0-9])*S(\d+M)?(\d{1,6}(\.\d{1,4})?))?|(M?\/(IT))|(M?\/(BT))|(\/\/([A-Z]{3})))( )?)*(\d+M( )?)?((?![0-9][A-Z])\d{1,6}(\.\d{1,4})?( )?)?((?<=[0-9])((?![A-Z][A-Z0-9]( )([A-Z]\/)?[A-Z]{3}|NUC|END|[A-Z]{3}( )[0-9])|(?=[A-Z][A-Z0-9]( )NUC))[A-Z][A-Z0-9\/]{0,8})?(( )?(([Q]{1}(\d+M)?(\d{1,6}(\.\d{1,4})?))|(P R\/([A-Z]{3})(\/)?([A-Z]{3})?( )?(\d+M)?(\d{1,6}(\.\d{1,4})?))|(P( )([A-Z]{6})( )?([A-Z]{6})?( )?(\d+M)?(\d{1,6}(\.\d{1,4})?))|(M( )?([A-Z]{6})?( )?(\d{1,6}(\.\d{1,4})?)?)|(H( )([A-Z]{6})( )?(\d{1,6}(\.\d{1,4})?))|(U( )(( )?([A-Z]{6}))+( )?(\d{1,6}(\.\d{1,4})?))|(C\/([A-Z]{3})(( )?[A-Z]{6})*( )?(\d{1,6}(\.\d{1,4})?))|(D( )((([A-Z])+\/)?([A-Z]{6})( )?((M)|(\d+M)|( )|(\d{1,6}(\.\d{1,4})?))( )?)+)|(\/-([A-Z]{3}))|(\/\/([A-Z]{3})))?( )?)*)+)+)( )?((( )?([A-Z]{3})( )?(\d{1,6}(\.\d{1,4})?))( )?(END)|(END))( )?(ROE( )?\d+(\.\d+)?)?(.*)?$";
string input = @"SIN UB X/RGN101.29ESGR UB NYT110.00YOW UB RGN110.00YOW RGN UB SIN 101";
foreach (Match m in Regex.Matches(input, pattern))
{
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