package com.gkhy.safePlatform.account.utils;
|
|
import java.util.regex.Matcher;
|
import java.util.regex.Pattern;
|
|
public class RegexUtil {
|
|
private static final String REGEX_MOBILE = "^((13[0-9])|(14[579])|(15([0-3]|[5-9]))|(16[56])|(17[0-8])|(18[0-9])|(19[1589]))\\d{8}$";
|
|
private static final String REGEX_EMAIL = "^([a-z0-9A-Z]+[-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$";
|
|
private static final String REGEX_PASSWORD = "";
|
|
|
|
/**
|
* 手机号码正则
|
* @param phone
|
* @return
|
*/
|
public static Boolean isMobile(String phone) {
|
return Pattern.compile(REGEX_MOBILE, Pattern.CASE_INSENSITIVE).matcher(phone).matches();
|
}
|
|
/**
|
* 邮箱正则
|
* @param email
|
* @return
|
*/
|
public static Boolean isEmail(String email) {
|
return Pattern.compile(REGEX_EMAIL, Pattern.CASE_INSENSITIVE).matcher(email).matches();
|
}
|
|
|
/**
|
* 密码正则匹配
|
* @param password
|
* @return
|
*/
|
public static Boolean isPassword(String password) {
|
return Pattern.compile(REGEX_PASSWORD, Pattern.CASE_INSENSITIVE).matcher(password).matches();
|
}
|
|
|
}
|