--

email+variant1@gmail.com is a valid email,

but the regex

^([a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6})?$

does qualify it as valid.

This is the Angular email validator pattern:

const EMAIL_REGEXP =

/^(?=.{1,254}$)(?=.{1,64}@)[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;

https://github.com/angular/angular/blob/fdec650ef260c145b74c01aca36dba69a7a25049/packages/forms/src/validators.ts

--

--

Andrea Koutifaris
Andrea Koutifaris

No responses yet