590
社区成员
发帖
与我相关
我的任务
分享
String at = "[rewrew{60}, 凡客{59}, 农夫山泉{27}, 特步{24}, 神州数码{21}]";
System.out.println(at.replaceAll("[^\\[\\]\\{\\}]+\\{(\\d+)\\}(,)?", "$1$2").replaceAll("\\[", "").replaceAll("\\]", ""));
Pattern p = Pattern.compile("\\{(\\d+)\\}");
Matcher m = p.matcher("[rewrew{60}, 凡客{59}, 农夫山泉{27}, 特步{24}, 神州数码{21}]");
while(m.find()){
System.out.println(m.group(1));
}