using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"\[(?<email1>[^\@]+\@[^\@]+)\]\s+\[.*emailAddress\"":\""(?<email2>[^\""]+)";
string input = @"[INFO ] 2020-11-16 20:52:30,729 (http-nio-8085-exec-127) [MyServiceImpl(emailServ:6431)] [my email@yahoo.com] [4223TD-E3DE-2345-8E59-1-YDHGC] Validation failed.Invalid. Response JSON {""emailAddress"":""mynewemail"",""statusReason"":""failed_syntax_check"",""domain"":"",""processedAt"":""2020-11-16 20:52:30 GMT-0700 (MST)"",""cache"":false,""account"":"",""status"":""invalid""}";
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