RegexUtil.java
630 Bytes
package com.topdraw.util;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* @author :
* @description:
* @function :
* @date :Created in 2022/6/29 15:10
* @version: :
* @modified By:
* @since : modified in 2022/6/29 15:10
*/
public class RegexUtil {
public static boolean mobileRegex(String mobile){
// String pattern = "0?(13|14|15|17|18|19)[0-9]{9}";
String pattern = "^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\\d{8}$";
Pattern r = Pattern.compile(pattern);
Matcher m = r.matcher(mobile);
return m.find();
}
}