using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"(.*Device:\s*(.*?)\s*Serial Number.*)|(.*Gerät:\s*(.*?)\s*Seriennummer.*)|(.*ICD-Model:\s*(.*?)\s*Serial Number:.*)|(.*ICD-Modell:\s*(.*?)\s*Seriennummer.*)|(.*Pacemaker Model:\s*(.*?)\s*Serial Number.*)|(.*Schrittmachermodell:\s*(.*?)\s*Seriennummer:.*)";
string input = @"Device:REVEAL LINQ LNQ11 Serial Number:RLA087267G Date of Visit:03-Jul-2019 08:10:51
Gerät:Viva Quad XT CRT-D DTBA2QQ Seriennummer:BLG613658S Untersuchungsdatum:27-Apr-2018 12:34:06
ICD-Modell: Marquis VR 7230 Seriennummer: PKD616419S Untersuchungsdatum:12, Mai 2015
ICD-Model: Marquis VR 7230 Serial Number: PKD616419S Untersuchungsdatum:12, Mai 2015
Pacemaker Model: Medtronic Adapta ADSR01 Serial Number: NWM851790 Date of Visit: 12/08/17
Schrittmachermodell: Medtronic Adapta ADVDD01 Seriennummer: NWG618042 Nachsorgedatum: 05.12.1";
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