using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"(===.*===[\s\S]*?)(?====|$)";
string input = @"=== Jun 11 14:05:39 - Person Details ===
Person Name = ""Hurlman""
Person Address = ""2nd Street Benjamin Blvd NJ""
Persion Age = 25
=== Jun 11 14:05:39 - Person Details ===
Person Name = ""Greg""
Person Address = ""3rd Street Benjamin Blvd NJ""
Persion Age = 26
=== Jun 11 14:05:42 - Person Details ===
Person Name = ""Michel""
Person Address = ""4th Street Benjamin Blvd NJ""
Persion Age = 27";
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