/** * * @return true为包含,false为不包含 */ /** * 判断是否含有特殊字符 * * @param str * @return true为包含,false为不包含 */ public static boolean isSpecialChar(String str) { String regEx = "[ _`~!@#$%^&*()+=|{}':;',\[\]<>/?~!@#¥%……&*()——+|{}【】‘;:”“’。,、?]| | | "; Pattern p = Pattern.compile(regEx); Matcher m = p.matcher(str); return m.find(); }