String s = "sfds55d66s76455dfg32434eertertre";
   String regEx = "[^0-9]";
   Pattern p = Pattern.compile(regEx);
   Matcher m = p.matcher(s);
   String result = m.replaceAll("").trim();

System.out.println(result);




原文链接:http://www.imooc.com/wenda/detail/342252

欢迎留言