有如下數組,要從中取出id:
"[\"3812662409\",\"3812633637\",\"3812627686\",\"3812651467\",\"3812628047\",\"3812650203\"]"
正則匹配可以直接用(\d+),假定上述數組為變量名為input的字符串,C#中可以寫作:
List<string> idList = new List<string>(); foreach(Match item in Regex.Matches(input, @"\d+")) { idList.Add(item.Value); }