String regex = "\d*";
Pattern p = Pattern.compile(regex);
Matcher m = p.matcher(需要截取的String);
String sumString = "";
while (m.find()) {
if (!"".equals(m.group())) {
sumString += m.group();
// System.out.println("come here:" + m.group());
}
}
示例:
123aaa3d2
运行结果:
12332
`



