1 func VerifyEmailFormat(email string) bool {
 2     pattern := `\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*` //匹配电子邮箱
 3     reg := regexp.MustCompile(pattern)
 4     return reg.MatchString(email)
 5 }
 6 
 7 func main() {
 8     fmt.Println(VerifyEmailFormat("12345@126.com")) //true
 9     fmt.Println(VerifyEmailFormat("12345126.com"))  //false
10 }

 

相关文章:

  • 2021-11-12
  • 2022-01-07
  • 2021-12-13
  • 2022-12-23
  • 2022-01-27
  • 2021-12-03
猜你喜欢
  • 2021-12-11
  • 2022-01-07
相关资源
相似解决方案