Open JochnGst opened 1 year ago
I found out that there is a conflict with the Key-LanguageRule
new LanguageRule(
$@"[,\{{]\s*({Regex_String})\s*:",
new Dictionary<int, string>
{
{1, ScopeName.JsonKey}
}),
for my case it works when I use this RegEx $@"[,\{{]\s*(""\w*"")\s*:"
But I know that this will not catch all edge cases for a JSON-Key
I found out that there is a conflict with the Key-LanguageRule
new LanguageRule( $@"[,\{{]\s*({Regex_String})\s*:", new Dictionary<int, string> { {1, ScopeName.JsonKey} }),
for my case it works when I use this RegEx
$@"[,\{{]\s*(""\w*"")\s*:"
But I know that this will not catch all edge cases for a JSON-Key
I made this to clean up the RegEx pattern:
public static List<string> ExtractKeys(string jsonString)
{
var keys = new List<string>();
var matches = Regex.Matches(jsonString, "[,\\{]\"(.*?)\"\\s*:");
foreach (Match match in matches) { keys.Add(match.Groups[1].Value); }
return keys;
}
@GuildOfCalamity @JochnGst Encountering the same problem, what is the reasonable solution?
This has become a serious issue for us; showing the colored JSON of certain Intune policies locks up our whole Blazor app making it unusable and taking down the environment with it.
Im trying to parse this JSON sipped to my Blazor page. But because of some weird RegEx parsing issue the process get stuck without any Exception. Can somebody tell me where there could be a Problem? here you can find my test project: ColorCodeTest
This is my Test Code
It stuck after the array Element
\"Winterglatter Fahrbahn\",
when it callregexMatch = regexMatch.NextMatch();
and I have no idear why this happends