Skip to content

Commit

Permalink
优化 匹配Json注释的正则
Browse files Browse the repository at this point in the history
  • Loading branch information
Hakoyu authored and Hakoyu committed May 4, 2023
1 parent 4db07d3 commit 4845046
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Libs/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ public static class Utils
private const string c_ZipFileHeadCode = "8075";
private const string c_RarFileHeadCode = "8297";
private const string c_7ZFileHeadCode = "55122";
private static readonly Regex sr_jsonCommentsRegex = new(@"[ \t]*#.*", RegexOptions.Compiled);
private static readonly Regex sr_jsonCommentsRegex =
new(@"(?<!:""[^""]*)#.*", RegexOptions.Compiled);
private static readonly Regex sr_jsonCommasRegex =
new(@",(?=[ \t\r\n]*[\]\}])|(?<=[\]\}]),[ \t\r\n]*\Z", RegexOptions.Compiled);
private static readonly Regex sr_jsonQuotesRegex =
Expand Down

0 comments on commit 4845046

Please sign in to comment.