转载地址: http://blog.youkuaiyun.com/nndhyp/article/details/6962463
String str = "xxx第47297章33";
String regex = "\\d*";
Pattern p = Pattern.compile(regex);
Matcher m = p.matcher(str);
while (m.find()) {
if (!"".equals(m.group()))
System.out.println("come here:" + m.group());
}
打印结果:
come here:47297 come here:33
本文展示了如何使用正则表达式从字符串中提取数字,通过实例详细说明了匹配和提取过程。
2335

被折叠的 条评论
为什么被折叠?



