1. I'll let you pass no questions asked:
* gotta have that '@' sign
* left of '@' sign must have greater than zero characters-- a-z, 0-9, dots are cool, plus whatever the rules are for international characters
* right of '@' whatever the rules are for domains
2. Pay me $1.99 through stripe to continue whatever you're trying to do, every time you're trying to do it:
* you've got double quotes, spaces, or other "actually, emails can contain..." bullshit in the local part of the addy
Consider RFC 3696, "Application Techniques for Checking and Transformation of Names". The author provides some example valid email addresses:
Abc\@def@example.com
Fred\ Bloggs@example.com
Joe.\\Blow@example.com
"Abc@def"@example.com
"Fred Bloggs"@example.com
customer/department=shipping@example.com
$A12345@example.com
!def!xyz%abc@example.com
A one line regular expression won't do much but block valid users. As has been said often in this thread, the best way to validate an email is to send to the address and confirm delivery through user interaction. Everything else is half-measures, often doing more harm than good."I haven't seen" != "no-one uses".
The errata are a doozy <https://www.rfc-editor.org/errata/rfc3696>, with a bad correction verified, a bad correction of that correction verified, and a reversion of the two incorrect corrections with incomplete justification (not quite mentioning the root cause, that you can’t actually use backslash-escaping outside a quoted-string like the RFC deliberately did) “held for document update” (which I suspect means that the reviewer finally realised the actual error, and decided it was too large to deal with with this way, but there are no verifier notes and I don’t know where the errata discussion records are, if they’re even public).
I wrote more, but it becomes all messy and confusing and I think I just discovered that according to RFC 2822’s and RFC 5322’s grammars, a space inside a quoted-string would actually need escaping, which would ruin "Fredd Bloggs"@example.com, which is widely understood to be valid. (This is because qtext lacks %d32 (space), which I think is accidental but it’s not entirely clear—it’s all bound up in the painful question of whether space is printable or not; see also <https://www.rfc-editor.org/errata/eid4692>. But their intent was clearly for space not to need escaping, as various examples all over the place use spaces unescaped in quoted-strings.)
So… I’m going to tip-toe gently away now and stop thinking about email address syntax for the rest of the day if I can help it.
/^\w+([\.-]?\w+)@\w+([\.-]?\w+)(\.\w{2,3})+$/
The only reliable method is to send an email with a token to the address.
Realistically, trying to validate email if you aren't in the business of providing an email service is a fool's errand that doesn't bring much to the table.