mirror of
https://github.com/bufanyun/hotgo.git
synced 2025-08-28 06:56:10 +08:00
fix email regex rule
This commit is contained in:
@@ -89,8 +89,8 @@ func IsMobile(mobile string) bool {
|
||||
|
||||
// IsEmail 是否为邮箱地址
|
||||
func IsEmail(email string) bool {
|
||||
// pattern := `\w+([-+.]\w+)@\w+([-.]\w+).\w+([-.]\w+)*` //匹配电子邮箱
|
||||
pattern := `^[0-9a-z][_.0-9a-z-]{0,31}@([0-9a-z][0-9a-z-]{0,30}[0-9a-z].){1,4}[a-z]{2,4}$`
|
||||
// pattern := `^[0-9a-z][_.0-9a-z-]{0,31}@([0-9a-z][0-9a-z-]{0,30}[0-9a-z].){1,4}[a-z]{2,4}$` //匹配电子邮箱
|
||||
pattern := `^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$`
|
||||
reg := regexp.MustCompile(pattern)
|
||||
return reg.MatchString(email)
|
||||
}
|
||||
|
Reference in New Issue
Block a user