Re:Stop Validating Email Addresses With Your Complex Regex
by prothid on Friday May 24, 2013 @11:47AM
(#5763566)
Yeah, I basically check for one @ sign and some very basic sanity checking on the right side.
/^[^@]+@[^@]+\.[^@.]+$/
Re:Stop Validating Email Addresses With Your Complex Regex
by claudius on Saturday May 25, 2013 @05:18AM
(#5766775)
As I just noticed, @ is valid in the local part of an email, too, it just has to be properly quoted (using \ or " "). You can send me email at
"a# b.@c"@[IPv6:2001:4dd0:fc8c::1]
a#\ b.\@c@[IPv6:2001:4dd0:fc8c::1]
now :-)
I personally prefer: /[^@]+@[^@]+\.[^@]+/
Basically the same except that it will throw an error if someone enters an extra at sign.