【fix sonar】StrAttackFilter文件

This commit is contained in:
梁琦涛
2023-04-03 15:07:57 +08:00
parent 854a9506d4
commit 83ff050b52
@@ -15,10 +15,10 @@ public class StrAttackFilter {
public static String filter(String str) throws PatternSyntaxException { public static String filter(String str) throws PatternSyntaxException {
// 清除掉所有特殊字符 // 清除掉所有特殊字符
String regEx = "[`_《》~!@#$%^&*()+=|{}':;',\\[\\].<>?~@#¥%……&*()——+|{}【】‘;:”“’。,、?]"; String regEx = "[`_《》~!@#$%^&*()+=|{}':;',\\[\\].<>?";
regEx += "~@#¥%……&*()——+|{}【】‘;:”“’。,、?]";
Pattern p = Pattern.compile(regEx); Pattern p = Pattern.compile(regEx);
Matcher m = p.matcher(str); Matcher m = p.matcher(str);
return m.replaceAll("").trim(); return m.replaceAll("").trim();
} }
} }