日期:2014-05-18 浏览次数:20925 次
[[-1,"bjs","北京",123432,"AAEE66",[[11561,"bj","aacc55","bjs","tt"], [11561,"Q","aacc55","bjs","QUINELLA"]],"中国"], [-1,"AG","梅特兰s",123436,"FF88CC",[[11464,"AU","dd88cc","AUs","dd"]],"澳洲"]]
string test = @"[[-1,""bjs"",""北京"",123432,""AAEE66"",[[11561,""bj"",""aacc55"",""bjs"",""tt""], [11561,""Q"",""aacc55"",""bjs"",""QUINELLA""]],""中国""], [-1,""AG"",""梅特兰s"",123436,""FF88CC"",[[11464,""AU"",""dd88cc"",""AUs"",""dd""]],""澳洲""]]"; Regex reg = new Regex(@"\[-1,[^,]+,""([^""]*)"",[^\[]+\[(?:\[(\d+),""([^""]*)""[^\]]*\],?\s*)*\],""([^""]*)""\]"); MatchCollection mc = reg.Matches(test); foreach (Match m in mc) { foreach (Capture c in m.Groups[3].Captures) { richTextBox2.Text += m.Groups[1].Value + " " + m.Groups[2].Value + " " + c + " " + m.Groups[4].Value + "\n"; } } /*-----输出----- 北京 11561 bj 中国 北京 11561 Q 中国 梅特兰s 11464 AU 澳洲 */