regex for email complicated
match an email more accurately
(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))
Regex Flags
global match
?
ignore case
?
multiline
?
dotAll
?
unicode
?
sticky
?
[email protected]
[email protected] [email protected]
[email protected]
hello@
@test
email@gmail
theproblem@[email protected]
Unnecessarily complicated email regex that works "more than" most of the times
Strict validation of email.
Although it's up for debate often, It's better to use simpler expressions whenever possible.
Check out a shorter - email regex
Cheatsheet
expr | usage |
---|---|
/[abcd]/ | matches any character in square brackets |
/[a-z]/ | matches all lowercase letters (a to z) |
/[0-9]/ | matches all digits |
iHateRegex
by
geon