邮箱验证:
private static Boolean checkEmail(String email) {
if (email.matches("1+[- | a-z0-9A-Z . _]+@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\.)+[a-z]{2,}KaTeX parse error: Expected 'EOF', got '}' at position 46: …eturn false;
}
}̲
手机号验证:
public …";
return check(cellphone, regex);
}
/**
- 验证固话号码
- @param telephone
- @return
*/
public static boolean checkTelephone(String telephone) {
String regex = “^(0\d{2}-\d{8}(-\d{1,4})?)|(0\d{3}-\d{7,8}(-\d{1,4})?)$”;
return check(telephone, regex);
}
-
a-z0-9A-Z ↩︎