Commit fbbd3bc66c5ba65a9fc333a361e859c4558cea0c
Committed by
Gitee
1 parent
467170d3
优化大陆手机号验证。以19013896321为例,原来的正则匹配结果为false。
Signed-off-by: 冰是睡着的水 <850083043@qq.com>
Showing
1 changed file
with
1 additions
and
1 deletions
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/validation/ValidationUtils.java
| @@ -16,7 +16,7 @@ import java.util.regex.Pattern; | @@ -16,7 +16,7 @@ import java.util.regex.Pattern; | ||
| 16 | */ | 16 | */ |
| 17 | public class ValidationUtils { | 17 | public class ValidationUtils { |
| 18 | 18 | ||
| 19 | - private static final Pattern PATTERN_MOBILE = Pattern.compile("^(?:(?:\\+|00)86)?1(?:(?:3[\\d])|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8[\\d])|(?:9[189]))\d{8}$"); | 19 | + private static final Pattern PATTERN_MOBILE = Pattern.compile("^(?:(?:\\+|00)86)?1(?:(?:3[\\d])|(?:4[0,1,4-9])|(?:5[0-3,5-9])|(?:6[2,5-7])|(?:7[0-8])|(?:8[\\d])|(?:9[0-3,5-9]))\d{8}$"); |
| 20 | 20 | ||
| 21 | private static final Pattern PATTERN_URL = Pattern.compile("^(https?|ftp|file)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]"); | 21 | private static final Pattern PATTERN_URL = Pattern.compile("^(https?|ftp|file)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]"); |
| 22 | 22 |