3 ms·
As per html5 spec the recommended regex is: /^[a-zA-Z0-9.!#$%&'+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)$/ http://www.w3.org/TR/html5/states-of-the-type
by 3ds 14y ago
As per html5 spec the recommended regex is:
/^[a-zA-Z0-9.!#$%&'+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)$/
http://www.w3.org/TR/html5/states-of-the-type-attribute.html#valid-e-mail-address http://www.w3.org/TR/html5/states-of-the-type-attribute.html...
- stratoukos 14y agoThis will not match addresses with non latin characters.
- mitchty 14y agoYep, shouldn't the right answer be: accept whatever the user gave you, validate it with a link in the email you send that they've received it. Should be even more important if you ever intend to do business with say someone from China. Good luck dealing with validating hanji in an email.
- tedunangst 14y agoAddresses do not have non Latin characters.
- Aissen 14y agoWhich is false: http://tools.ietf.org/html/rfc6530 http://tools.ietf.org/html/rfc6530 http://tools.ietf.org/html/rfc6531 http://tools.ietf.org/html/rfc6531 http://tools.ietf.org/html/rfc6532 http://tools.ietf.org/html/rfc6532 http://tools.ietf.org/html/rfc6533 http://tools.ietf.org/html/rfc6533
- tedunangst 14y agoRelying on standards that new for something like email would be a mistake IMO. Ymmv.
- ambiguity 14y agoYou are missing a * just before the $.