private static void test6() {
// 提取张三 去除数字
String r_name3 = "张三 1359999你好8888 000000";
// Pattern pattern = Pattern.compile("[\\d]");
// Pattern pattern = Pattern.compile("\\d*");
Pattern pattern = Pattern.compile("\\d");
Matcher matcher = pattern.matcher(r_name3);
System.out.println(matcher.replaceAll("").trim());
}
private static void test5() {
String phoneString = "哈哈,1388888额9999";
// String phoneString = "MemTotal: 808964 kB";
// 提取数字
// 1
Pattern pattern = Pattern.compile("[^0-9]");
Matcher matcher = pattern.matcher(phoneString);
String all = matcher.replaceAll("");// 不属于任何匹配的字符被直接添加到结果字符串
System.out.println("phone:" + all);
// 2
Pattern.compile("[^0-9]").matcher(phoneString).replaceAll("");
}