优化大陆手机号验证。以19013896321为例,原来的正则匹配结果为false。

Signed-off-by: 冰是睡着的水 <850083043@qq.com>
This commit is contained in:
冰是睡着的水 2023-04-01 03:34:22 +00:00 committed by Gitee
parent 467170d3de
commit fbbd3bc66c
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -16,7 +16,7 @@ import java.util.regex.Pattern;
*/
public class ValidationUtils {
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}$");
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}$");
private static final Pattern PATTERN_URL = Pattern.compile("^(https?|ftp|file)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]");