1. /**
    2. * 正则表达式工具类
    3. * @title: RegexpUtils
    4. * @description:
    5. */
    6. public class RegexpUtils {
    7. /**
    8. * 验证手机号
    9. */
    10. public static final String PHONE = "^((13[0-9])|(15[^4,\\D])|(18[0,5-9]))\\d{8}$";
    11. /**
    12. * 验证邮箱地址
    13. */
    14. public static final String EMAIL = "\\w+(\\.\\w)*@\\w+(\\.\\w{2,3}){1,3}";
    15. /**
    16. * 验证手机号
    17. * @param phone
    18. * @return
    19. */
    20. public static boolean checkPhone(String phone) {
    21. return phone.matches(PHONE);
    22. }
    23. /**
    24. * 验证邮箱
    25. * @param email
    26. * @return
    27. */
    28. public static boolean checkEmail(String email) {
    29. return email.matches(EMAIL);
    30. }
    31. }