what is the correct one. found like 5 online
regex for validating email?
Your discussion
This browser holds the management token for this post.
Save management token
Keep this private. Anyone with the token can resolve, edit, or delete this discussion.
3 replies
There isn't a correct one. Check that there's something, then an @, then something with no spaces, and then send them a message with a link. That's the only test that tells you whether it's a real address that belongs to them.
^[^@\s]+@[^@\s]+$ and move on. Every stricter one I've seen in production rejects somebody's real address, usually with a plus sign or a newer TLD in it.
The full RFC one is a page long. People print it out to frighten juniors.