From 0f3212098d0af7665a3da684de4293a4bacfcf66 Mon Sep 17 00:00:00 2001 From: Liuyang <2746366019@qq.com> Date: Wed, 22 Jan 2025 19:15:57 +0800 Subject: [PATCH] =?UTF-8?q?[update]=20=E6=95=B0=E6=8D=AE=E5=A4=84=E7=90=86?= =?UTF-8?q?=EF=BC=9A=E5=8E=BB=E9=9A=90=E7=A7=81=E9=85=8D=E7=BD=AE=20?= =?UTF-8?q?=E5=8E=BB=E9=99=A4=E7=94=B5=E8=AF=9D=E5=8F=B7=E7=A0=81=20?= =?UTF-8?q?=E8=A1=A5=E5=85=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yudao/module/llm/utils/DataProcessUtil.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/utils/DataProcessUtil.java b/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/utils/DataProcessUtil.java index 412fffb4d..1509ad7de 100644 --- a/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/utils/DataProcessUtil.java +++ b/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/utils/DataProcessUtil.java @@ -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; }