using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"^\d{2}\/(.++\n){3}(?=.+Success)(.++\n){3}(?=.+ABC).++";
string input = @"04/09/2018 06:31:59 AM [class | Info] some message received from 101592 (123.123.123.124)
Request Id: 0 (Descriptor: 0, Operator Request Id: 0)
A type: bar
A status: Queued
The id: 1E25
Additional info: Inserted in queue at position 1 on device ABC
Location: ABC, subarea: 2
04/09/2018 06:31:59 AM [class | Info] some message received from 102364 (123.123.123.123)
Request Id: 0 (Descriptor: 0, Operator Request Id: 0)
A type: bar
A status: Queued
The id: 1E25
Additional info: Inserted in queue at position 1 on device ABC
Location: ABC, subarea: 2
04/09/2018 06:31:59 AM [class | Info] some message received from 102364 (123.123.123.123)
Request Id: 0 (Descriptor: 0, Operator Request Id: 0)
A type: blah bit foo
A status: Success
The id: T908
Additional info:
Location: DEF, subarea: 3
04/09/2018 06:32:00 AM [class | Info] some message received from 102364 (123.123.123.123)
Request Id: 0 (Descriptor: 0, Operator Request Id: 0)
A type: bar
A status: Success
The id: DG08
Additional info:
Location: ABC, subarea: 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