using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"^(?<timestamp>\d+-\d+-\d+T\d+:\d+:\d+\.\d+([+-])\d+:\d+)\s+\[(?<severity>\w+)\](?<message>.*(?:\n(?!\d+-\d+-\d+T).*)*)$";
string input = @"2022-06-27T15:22:35.506+00:00 [Info] MSAT starting with 60000 tick ...
2022-06-27T15:22:35.506+00:00 [Info] pram[:9999] starting ...
2022-06-27T15:22:35.508+00:00 [Info] New settings received:
{""indexer.settings.compaction.days_of_week"":""Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday"",""indexer.settings.compaction.interval"":""00:00,00:00"",""indexer.settings.compaction.compaction_mode"":""circular"",""indexer.settings.log_level"":""info"",""indexer.settings.persisted_snapshot.interval"":5000,""indexer.settings.compaction.min_frag"":30,""indexer.settings.inmemory_snapshot.interval"":200,""indexer.settings.max_cpu_percent"":0,""indexer.settings.storage_mode"":""forestdb"",""indexer.settings.recovery.max_rollbacks"":5,""indexer.settings.memory_quota"":1073741824,""indexer.settings.compaction.abort_exceed_interval"":false}
2022-06-27T15:22:35.508+00:00 [Info] PROJ[:9999] settings notifier from metakv
";
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