private static int OutputAndRemoveDataPoint(TextBlock target, string toOutput) { var pattern = @"(¤(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\¤])*¤(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)".Replace('¤', '"'); var matches = Regex.Matches(toOutput, pattern); if (Regex.IsMatch(matches[0].Value, @"^¤".Replace('¤', '"'))) { if (Regex.IsMatch(matches[0].Value, ":$")) { // key target.OutputBold(matches[0].Value.Replace('\"', '\0') + "\t"); } else { // string target.OutputWithFormat(matches[0].Value + Environment.NewLine, fontColor: Colors.DarkGreen); } } else if (Regex.IsMatch(matches[0].Value, "true|false")) { // boolean target.OutputWithFormat(matches[0].Value.Replace('\"', '\0') + Environment.NewLine, fontColor: Colors.DarkBlue); } else if (Regex.IsMatch(matches[0].Value, "null")) { // null target.OutputWithFormat(matches[0].Value.Replace('\"', '\0') + Environment.NewLine, fontColor: Colors.DarkBlue); } else { // number target.OutputWithFormat(matches[0].Value.Replace('\"', '\0') + Environment.NewLine, fontColor: Colors.DarkCyan); } return matches[0].Length; }