You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
340 B
14 lines
340 B
package EmailUtil
|
|
|
|
import "regexp"
|
|
|
|
//email verify
|
|
func VerifyEmailFormat(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}$`
|
|
|
|
reg := regexp.MustCompile(pattern)
|
|
return reg.MatchString(email)
|
|
}
|
|
|