java后台验证手机号,邮箱格式正则匹配: private Integer getType(String account) { String mobile = "^((1[3,5,8][0-9])|(14[5,7])|(17[0,1,6,7,8]))\\d{8}$"; String email = "^([a-z0-9A-Z]+[-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$"; if (!StringUtil.isBlank(account)) { boolean flag = Pattern.matches(email, account); if (flag) { return 0; } else { boolean flag2 = Pattern.matches(mobile, account); if (flag2) { return 1; } } } return 2; }