/** * 提取字符串中所有的汉字 * * @param str * @return * @throws Exception */ public String intercept(String str) throws Exception { String regex = "[\u4E00-\u9FA5]";//汉字 Matcher matcher = Pattern.compile(regex).matcher(str); StringBuffer sb = new StringBuffer(); while (matcher.find()) { sb.append(matcher.group()); } return sb.toString(); }