验证邮箱 @param email @return
(String email)
| 54 | * @return |
| 55 | */ |
| 56 | public static boolean checkEmail(String email) { |
| 57 | boolean flag = false; |
| 58 | try { |
| 59 | String check = "^\\w+@[a-zA-Z0-9]{2,10}(?:\\.[a-z]{2,4}){1,3}$"; |
| 60 | // String regex = "\\w+([-+.']\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*"; //这个也可以用 |
| 61 | Pattern regex = Pattern.compile(check); |
| 62 | Matcher matcher = regex.matcher(email); |
| 63 | flag = matcher.matches(); |
| 64 | } catch (Exception e) { |
| 65 | flag = false; |
| 66 | } |
| 67 | return flag; |
| 68 | } |
| 69 | |
| 70 | } |
| 71 |
no outgoing calls
no test coverage detected