截取数字

来源:互联网 发布:泽域数码专营店 知乎 编辑:程序博客网 时间:2024/06/11 00:59
  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:47297come here:33
原创粉丝点击