Email address consists of two parts local
before @ and domain
that goes after.
Rules to these parts are different:
For local part
you can use ASCII:
- Latin letters A – Z a – z
- digits 0 – 9
- special characters !#$%&’*+-/=?^_`{|}~
- dot ., that it is not first or last, and not in sequence
- space and “(),:;<>@[] characters are allowed with restrictions (they are only allowed inside a quoted string, a backslash or double-quote must be preceded by a backslash)
Plus since 2012 you can use international characters above U+007F
, encoded as UTF-8.
Domain part
is more restricted:
- Latin letters A – Z a – z
- digits 0 – 9
- hyphen -, that is not first or last, multiple hyphens in sequence are allowed.
Regex to validate
^(([^<>()\[\]\.,;:\s@\"]+(\.[^<>()\[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})
Hope this saves you some time.