import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class test{
public static void main(String[] args) {
String str = "123abc中文cde123abc提取123ab我ABC汉DEF和我们678,854中华人民共和国,美国";
Pattern p = null;
Matcher m = null;
String value = null;
p = Pattern.compile("([\u4e00-\u9fa5]+)");
m = p.matcher(str);
while (m.find()) {
value = m.group(0);
System.out.println(value);
}
}
}
留着以后用到的
时间: 2024-10-22 02:17:37