private static final String MAIL_REGEX = "^([a-z0-9A-Z]+[_|-|\\.]?)+[a-z0-9A-Z]@"
+"([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$";
private static final String PUSH_TOKEN_REGEX = "^([a-z0-9A-Z]{64})$";
private static final int MAIL_LENGTH = 98;
/**
* Description:邮件格式校验
*
* @author qiaowang
* @param mail
* @return boolean
*/
public static boolean checkMail(String mail) {
if (mail == null) {
throw new NullPointerException("mail is null");
}
if(mail.length() > MAIL_LENGTH){
return Boolean.FALSE;
}
Pattern regex = Pattern.compile(MAIL_REGEX);
Matcher matcher = regex.matcher(mail);
return matcher.matches();
}
public static boolean checkPushToken(String pushToken) {
if (pushToken == null) {
throw new NullPointerException("push token is null");
}
Pattern regex = Pattern.compile(PUSH_TOKEN_REGEX);
Matcher matcher = regex.matcher(pushToken);
return matcher.matches();
}
+"([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$";
private static final String PUSH_TOKEN_REGEX = "^([a-z0-9A-Z]{64})$";
private static final int MAIL_LENGTH = 98;
/**
* Description:邮件格式校验
*
* @author qiaowang
* @param mail
* @return boolean
*/
public static boolean checkMail(String mail) {
if (mail == null) {
throw new NullPointerException("mail is null");
}
if(mail.length() > MAIL_LENGTH){
return Boolean.FALSE;
}
Pattern regex = Pattern.compile(MAIL_REGEX);
Matcher matcher = regex.matcher(mail);
return matcher.matches();
}
public static boolean checkPushToken(String pushToken) {
if (pushToken == null) {
throw new NullPointerException("push token is null");
}
Pattern regex = Pattern.compile(PUSH_TOKEN_REGEX);
Matcher matcher = regex.matcher(pushToken);
return matcher.matches();
}