LintCode练习:2832 · 简单校验一下邮箱格式

他来了他来了,调了好几个Bug它终于通过了!

原题:

 

 参考代码:

1 public class Solution {
2     public static boolean isMatch(String s) {
3         String regex = "^([A-Za-z]|_)([.\\w-]+)@([.\\w-]+)(.com)(|(.[\\w]+))$";
4         return(s.matches(regex));
5     }
6 }

 

posted @ 2022-01-06 17:27  achived  阅读(49)  评论(0编辑  收藏  举报