using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"\(*(\w{3})[-_~\s*\.]*?(\d{1,}|\d*.\d*.\d*)[-_\s.~]*?(FTP|IMG|SCR|LIV|TVU).?-?\s?(\w{3}).\s?-?_?~?\.?(\d*).\s?-?~?_?\.?(.*)";
string input = @"((NWS_20-12-19_FTP_VLR_01_This is a test message))
(NWS 11219 LIV TNL 02 Second test message)
(((NWS~11/12/2019~IMG-KNK-4-third_test_message)))
(NWS-12-12-19-SCR-TVM-03-Fourth-test-message))
((NWS - 12.12.2019 - FTP - CGP -5 - fifth test message)
(NWS_12.12/19~FTP-CHN 01_sixth test message ";
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