-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JSON Parsing - deadlock/stuck on parsing Json to HTML #36
Comments
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 |
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 |
I believe the issue relates to excessive regex backtracking when parsing json keys. Atomic groups can be used by tweaking the original new LanguageRule(
$@"[,\{{]\s*({Regex_String})\s*:",
new Dictionary<int, string>
{
{1, ScopeName.JsonKey}
}) to new LanguageRule(
$@"[,\{{]\s*(?>{Regex_String})\s*:",
new Dictionary<int, string>
{
{1, ScopeName.JsonKey}
}) |
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 happendsThe text was updated successfully, but these errors were encountered: