Skip to content

Commit

Permalink
Updating Validators for the email address (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
cjlapao authored Sep 12, 2024
1 parent 9d02ba2 commit cd82bd7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion validators/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit cd82bd7

Please sign in to comment.