package regx import "regexp" // 校验邮件地址有效性 func (rr *Regx) IsMail(mail string) bool { 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(mail) }