[java]利用正則表達式驗證Email字符串
1 public boolean checkEmail(String mail){
2 String regex = "\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*";
3 Pattern p = Pattern.compile(regex);
4 Matcher m = p.matcher(mail);
5 return m.find();
6 }
2 String regex = "\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*";
3 Pattern p = Pattern.compile(regex);
4 Matcher m = p.matcher(mail);
5 return m.find();
6 }
posted on 2007-08-23 00:35 yanyan 閱讀(383) 評論(0) 編輯 收藏 所屬分類: java