判斷手機(jī)號是否有效
public static boolean isMobileNO(String mobiles) {
Pattern pattern = Pattern.compile("^1[3|4|5|7|8]\\d{9}$");
return !TextUtils.isEmpty(mobiles) && pattern.matcher(mobiles).matches() && mobiles.length() == 11;
}
判斷郵箱是否合法
public static boolean isEmail(String email) {
Pattern pattern = Pattern.compile("\\w+(\\.\\w)*@\\w+(\\.\\w{2,3}){1,3}");
return !TextUtils.isEmpty(email) && pattern.matcher(email).matches();
}