注册邮箱支持多个"_", 如 a__a@a.com

This commit is contained in:
lealife
2015-10-10 15:02:55 +08:00
parent 0438bbb414
commit 711e6b3d17
2 changed files with 3 additions and 3 deletions

View File

@ -265,7 +265,7 @@ func IsEmail(email string) bool {
if email == "" {
return false;
}
ok, _ := regexp.MatchString(`^([a-zA-Z0-9]+[_|\_|\.|\-]?)*[a-z\-A-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.|\-]?)*[a-zA-Z0-9\-]+\.[0-9a-zA-Z]{2,3}$`, email)
ok, _ := regexp.MatchString(`^([a-zA-Z0-9]+[_|\_|\.|\-]?)*[_a-z\-A-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.|\-]?)*[a-zA-Z0-9\-]+\.[0-9a-zA-Z]{2,6}$`, email)
return ok
}

View File

@ -72,7 +72,7 @@ $(function() {
showMsg("{{msg . "inputEmail"}}", "email");
return;
} else {
var myreg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[0-9a-zA-Z]{2,3}$/;
var myreg = /^([a-zA-Z0-9]+[_|\_|\.|\-]?)*[a-zA-Z0-9\-_]+@([a-zA-Z0-9\-]+[_|\_|\.|\-]?)*[a-zA-Z0-9\-]+\.[0-9a-zA-Z]{2,6}$/;
if(!myreg.test(email)) {
showMsg("{{msg . "wrongEmail"}}", "email");
return;
@ -117,4 +117,4 @@ $(function() {
});
</script>
</body>
</html>
</html>