邮箱验证的正则有误
This commit is contained in:
@@ -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")
|
||||||
|
|||||||
Reference in New Issue
Block a user