/**

* 过滤特殊字符

* @param str

* @return

* @throws PatternSyntaxException

*/

public static String FilterStr(String str) throws PatternSyntaxException {

/**

* 特殊字符表达式

*/

String regEx = "[`~!@#$%^&*()+=|{}':;'\\[\\].<>/?~!@#¥%……&*()——+|{}【】‘;:”“’。、?_ ]";



Pattern pat = Pattern.compile(regEx);

Matcher mat = pat.matcher(str);



/**

* 返回替换结果

*/

return mat.replaceAll("").trim();

}