From cd82bd7a16b4a8cfa1463c1f16aeddef7b161043 Mon Sep 17 00:00:00 2001 From: Carlos Lapao Date: Thu, 12 Sep 2024 13:12:49 +0100 Subject: [PATCH] Updating Validators for the email address (#34) --- validators/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/validators/main.go b/validators/main.go index a5ff694..2a56f0f 100644 --- a/validators/main.go +++ b/validators/main.go @@ -4,7 +4,7 @@ import "regexp" // ValidateEmailAddress Validates an email string using a regular expression func ValidateEmailAddress(email string) bool { - exp := regexp.MustCompile(`^[-a-z0-9~!$%^&*_=+}{\'?]+(\.[-a-z0-9~!$%^&*_=+}{\'?]+)*@([a-z0-9_][-a-z0-9_]*(\.[-a-z0-9_]+)*\.(aero|arpa|biz|com|coop|edu|gov|info|int|mil|museum|name|net|org|pro|travel|mobi|[a-z][a-z])|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))(:[0-9]{1,5})?$`) + exp := regexp.MustCompile(`^[-a-z0-9~!$%^&*_=+}{\'?]+(\.[-a-z0-9~!$%^&*_=+}{\'?]+)*@([a-z0-9_][-a-z0-9_]*(\.[-a-z0-9_]+)*\.(aero|arpa|biz|com|coop|edu|gov|info|int|mil|museum|name|net|org|pro|travel|mobi|[a-z]{1,10})|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))(:[0-9]{1,5})?$`) result := exp.MatchString(email) return result }