using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"^(?s).*Subject:(?<identificationValue>ST[0-9]*)\.\d*\.\d*\.(?<identifier>[0-9]*).*Text: (?<remark>.*)Code:.*$";
string input = @"From:stoerungen@fe-trading.at
Subject:ST412.3.3.28 [RCT/28]: Kartenleserfehler, bitte pruefen!
Send date:Mon May 08 13:28:51 CET 2017
Content type:text/plain; charset=""iso-8859-1""
System: RCT/FAULT (08.05.2017 13:28:51)
Station: ST412, 4846 Redlham, Gewerbepark Ost 27
Text: Kartenleserfehler, bitte pruefen!
Gruppe: 3
Device: 3
Code: 28";
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