日期:2014-05-18 浏览次数:20815 次
:\s*\(
------解决方案--------------------
using System; using System.Text.RegularExpressions; public class Test { static void Main(string[] args) { string str = @"({result: (""A"":{1,2,3}, ""B"":{4,5,6}, ""C"":{7,8,9}, total:26)})"; MatchCollection mc = Regex.Matches(str, @"""[A-Z].*?}"); int count = mc.Count; if (count > 0) { Console.WriteLine("存在数据"); for (int i = 0; i < count; i++) { Console.WriteLine(mc[i].Value); } } else { Console.WriteLine("什么都没有"); } Console.ReadKey(); } } results: 存在数据 "A":{1,2,3} "B":{4,5,6} "C":{7,8,9}