3 ms·
15. If you want to validate an email address send them a validation email.
by johncessna 4y ago
15. If you want to validate an email address send them a validation email.
- chadlavi 4y agoThis is the way. Or if you REALLY want a regex for an input, /[^\s]+@[^\s]+/ seems as sure as you can get without excluding a valid address somewhere. At least one non-whitespace character followed by an @ followed by at least one non-whitespace character. Any more specific than that and it's dicey. But also just send an email instead if you need to validate the email address.
- deepspace 4y agoHa, that is how I have always done it. Verify that there is at least one @ in the "address", and then send a verification email to it. The software that is most qualified to validate a user's email address, is the user's email server software. Why would I want to duplicate everything it does?