Java 正则提取数字串

例如:有一个字符串:"数量最低2000份",将其中的2000数字提取出来。

     String arg0 = "数量最低2000份";
        Pattern p = Pattern.compile("\\d+");
        Matcher m = p.matcher(arg0);
        String result = "";
        if(m.find()){
            result = m.group(0);
        }
        System.out.println(result);

打印出:2000

posted @ 2014-05-07 14:19  yshy  阅读(1363)  评论(0编辑  收藏  举报