Progrider

Programming discussion

Board index
Help · Open discussion · regex

regex for validating email?

what is the correct one. found like 5 online

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.

Add a reply

Formatting help. Public, and removed when the thread expires.

Type name#secret for a tripcode, an identity others can't copy.

Posts and requests are logged for research. Privacy notice.