java利用正则截取字符串中的数字
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());
}
只能输入整数或小数的正则表达式
"^[0-9]+([.]{1}[0-9]+){0,1}$" :cry:
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());
}
只能输入整数或小数的正则表达式
"^[0-9]+([.]{1}[0-9]+){0,1}$" :cry: