public static boolean StringFilter(String str)
throws PatternSyntaxException {
// 只允许字母和数字
// String regEx = "[^a-zA-Z0-9]";
// 清除掉所有特殊字符
if (str.replaceAll("[\u4e00-\u9fa5]*[a-z]*[A-Z]*\\d*-*_*\\s*", "")
.length() == 0) {
// 如果不包含特殊字符
return true;
}
return false;
}