Skip to content

Commit 2ef3a0d

Browse files
authored
邮箱验证的正则有误
1 parent d970f1d commit 2ef3a0d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

zh/04.2.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ if m, _ := regexp.MatchString("^[a-zA-Z]+$", r.Form.Get("engname")); !m {
6464
你想知道用户输入的一个Email地址是否正确,通过如下这个方式可以验证:
6565
```Go
6666

67-
if m, _ := regexp.MatchString(`^([\w\.\_]{2,10})@(\w{1,}).([a-z]{2,4})$`, r.Form.Get("email")); !m {
67+
if m, _ := regexp.MatchString(`^([\w\.\_]{2,10})@(\w{1,})\.([a-z]{2,4})$`, r.Form.Get("email")); !m {
6868
fmt.Println("no")
6969
}else{
7070
fmt.Println("yes")

0 commit comments

Comments
 (0)