This commit is contained in:
wangjinlei
2023-11-07 17:14:15 +08:00
parent 5b71036241
commit a152865cfe
10 changed files with 42 additions and 29 deletions

View File

@@ -0,0 +1,15 @@
package com.peanut.common.utils;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class TelUtil {
public static boolean isPhone(String Phone_number) {
String regex = "^((13[0-9])|(14(0|[5-7]|9))|(15([0-3]|[5-9]))|(16(2|[5-7]))|(17[0-8])|(18[0-9])|(19([0-3]|[5-9])))\\d{8}$";
Pattern p = Pattern.compile(regex, Pattern.CASE_INSENSITIVE);
Matcher m = p.matcher(Phone_number);
return m.matches();
}
}