邮箱验证的正则有误

This commit is contained in:
marun
2019-05-18 12:52:23 +08:00
committed by GitHub
parent d970f1d772
commit 2ef3a0d6d2

View File

@@ -64,7 +64,7 @@ if m, _ := regexp.MatchString("^[a-zA-Z]+$", r.Form.Get("engname")); !m {
你想知道用户输入的一个Email地址是否正确通过如下这个方式可以验证 你想知道用户输入的一个Email地址是否正确通过如下这个方式可以验证
```Go ```Go
if m, _ := regexp.MatchString(`^([\w\.\_]{2,10})@(\w{1,}).([a-z]{2,4})$`, r.Form.Get("email")); !m { if m, _ := regexp.MatchString(`^([\w\.\_]{2,10})@(\w{1,})\.([a-z]{2,4})$`, r.Form.Get("email")); !m {
fmt.Println("no") fmt.Println("no")
}else{ }else{
fmt.Println("yes") fmt.Println("yes")