判断是否是手机号码和手机号码的正则表达式

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/QQ1375235976/article/details/51543532
//是否是手机号码
public static boolean isMobileNo(String mobiles){
String telRegex = "[1][34578]\\d{9}";
if(TextUtils.isEmpty(mobiles)){
return false;
}else
return mobiles.matches(telRegex);
}

//是否是邮箱地址
public static boolean emailValidation(String emailAddr){
String regex = "\\w+([_+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*";
return emailAddr.matches(regex);
}

猜你喜欢

转载自blog.csdn.net/QQ1375235976/article/details/51543532