如何从一个乱七八糟的字符串中取出我们要的字符串呢?
很简单:
Matcher mt = Pattern.compile("[\\u4E00-\\u9FA5\\uf900-\\ufa2d\\w]").matcher("中^%^&%^&文Eng_12*345^%$a&bc");
String temp = "";while(mt.find()){
temp +=mt.group();
}
System.out.println(temp);
输出结果:中文Eng_12345abc
如何从一个乱七八糟的字符串中取出我们要的字符串呢?
很简单:
Matcher mt = Pattern.compile("[\\u4E00-\\u9FA5\\uf900-\\ufa2d\\w]").matcher("中^%^&%^&文Eng_12*345^%$a&bc");
String temp = "";System.out.println(temp);
输出结果:中文Eng_12345abc