From 7af3b5ad7c781e3b6e31b550b0f0f314d97c9830 Mon Sep 17 00:00:00 2001 From: ZhouXY108 Date: Fri, 29 Nov 2024 18:24:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=AD=A3=E5=88=99=E5=B8=B8?= =?UTF-8?q?=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xyz/zhouxy/plusone/commons/constant/PatternConsts.java | 4 +++- .../xyz/zhouxy/plusone/commons/constant/RegexConsts.java | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/xyz/zhouxy/plusone/commons/constant/PatternConsts.java b/src/main/java/xyz/zhouxy/plusone/commons/constant/PatternConsts.java index b14da6e..6bb7048 100644 --- a/src/main/java/xyz/zhouxy/plusone/commons/constant/PatternConsts.java +++ b/src/main/java/xyz/zhouxy/plusone/commons/constant/PatternConsts.java @@ -27,7 +27,9 @@ public final class PatternConsts { // TODO 【添加】 新增身份证等正则常量 - public static final Pattern DATE = Pattern.compile(RegexConsts.DATE); // TODO 【优化】 修改为对应的日期格式名称 + public static final Pattern BASIC_ISO_DATE = Pattern.compile(RegexConsts.BASIC_ISO_DATE); + + public static final Pattern ISO_LOCAL_DATE = Pattern.compile(RegexConsts.ISO_LOCAL_DATE); public static final Pattern PASSWORD = Pattern.compile(RegexConsts.PASSWORD); diff --git a/src/main/java/xyz/zhouxy/plusone/commons/constant/RegexConsts.java b/src/main/java/xyz/zhouxy/plusone/commons/constant/RegexConsts.java index dae09ec..aa2ca36 100644 --- a/src/main/java/xyz/zhouxy/plusone/commons/constant/RegexConsts.java +++ b/src/main/java/xyz/zhouxy/plusone/commons/constant/RegexConsts.java @@ -27,13 +27,15 @@ public final class RegexConsts { // TODO 【添加】 新增身份证等正则常量 - public static final String DATE = "^\\d{4}-\\d{2}-\\d{2}"; // TODO 【优化】 修改为对应的日期格式名称 + public static final String BASIC_ISO_DATE = "^(?\\d{4})(?\\d{2})(?\\d{2})"; + + public static final String ISO_LOCAL_DATE = "^(?\\d{4})-(?\\d{2})-(?\\d{2})"; public static final String PASSWORD = "^(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])[\\w\\\\!#$%&'*\\+\\-/=?^`{|}~@\\(\\)\\[\\]\",\\.;':><]{8,32}$"; public static final String CAPTCHA = "^[0-9A-Za-z]{4,6}$"; - public static final String EMAIL = "^\\w+([-+.]\\w+)*@[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})*(\\.(?![0-9]+$)[a-zA-Z0-9][-0-9A-Za-z]{0,62})$"; + public static final String EMAIL = "(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])"; public static final String MOBILE_PHONE = "^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\\d{8}$";