Here is the code I am testing that does not match my pattern:
using System;
using System.Text.RegularExpressions;
public class Program
{
public static void Main()
{
string test = "Error during request to host: 123.456.78, port: 1234 with status 500 and message={\n \"messageID\": \"TEST_ID\",\n \"messageArgs\": [\n \"12345\"\n ],\n \"message\": \"The test having ID \\\"12345\\\" was not found.\",\n \"recommendedActions\": []\n}";
Match m = Regex.Match(test, @"message=({.*})", RegexOptions.IgnoreCase | RegexOptions.Multiline);
Console.WriteLine(m.Success);
Console.WriteLine(test);
if(m.Success){
Console.WriteLine(m.Groups[0]);
Console.WriteLine(m.Groups[1]);
}
}
}
For some reason this does not work, but I believe the pattern is correct to capture what is inside of message={}.
Here is it working in regex 101: https://regex101.com/r/yY2bQ4/1