[update] 数据处理:去隐私配置 去除电话号码 补充

This commit is contained in:
Liuyang 2025-01-22 19:15:57 +08:00
parent 8fe4183adf
commit 0f3212098d

View File

@ -533,6 +533,11 @@ public class DataProcessUtil {
*/
private static final String DOMESTIC_PHONE_REGEX = "(\\d{4}-|\\d{3}-)?(\\d{8}|\\d{7})";
/**
* 电话号码400的正则表达式
*/
private static final String PHONE_REGEX = "400(-\\d{3,4}){2}|^800(-\\d{3,4}){2}";
/**
* 信用卡号的正则表达式
*/
@ -546,6 +551,7 @@ public class DataProcessUtil {
// 编译正则表达式为Pattern对象
private static final Pattern MOBILE_PATTERN = Pattern.compile(MOBILE_REGEX);
private static final Pattern DOMESTIC_PHONE_PATTERN = Pattern.compile(DOMESTIC_PHONE_REGEX);
private static final Pattern PHONE_PATTERN = Pattern.compile(PHONE_REGEX);
private static final Pattern CREDIT_CARD_PATTERN = Pattern.compile(CREDIT_CARD_REGEX);
private static final Pattern HASH_PATTERN = Pattern.compile(HASH_REGEX);
@ -609,6 +615,10 @@ public class DataProcessUtil {
Matcher domesticPhoneMatcher = DOMESTIC_PHONE_PATTERN.matcher(text);
text = domesticPhoneMatcher.replaceAll("");
// 电话号码400的正则表达式
Matcher phoneMatcher = PHONE_PATTERN.matcher(text);
text = phoneMatcher.replaceAll("");
return text;
}