110,567
社区成员
发帖
与我相关
我的任务
分享
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}
:\s*\(
split结果,在用(?<=}),
split