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;
}