标签:check pat reg regex return pil 输入 ret 正则
String check = "^\\s*\\w+(?:\\.{0,1}[\\w-]+)*@[a-zA-Z0-9]+(?:[-.][a-zA-Z0-9]+)*\\.[a-zA-Z]+\\s*$";
Pattern regex = Pattern.compile(check);
Matcher matcher = regex.matcher(email);
boolean flag = matcher.matches();
if(!flag){
msg="您输入的邮箱格式不正确!";
return msg;
}
标签:check pat reg regex return pil 输入 ret 正则
原文地址:http://www.cnblogs.com/knightsu/p/7479554.html