TE
TechEcho
Home
24h Top
Newest
Best
Ask
Show
Jobs
English
GitHub
Twitter
Home
What is the most correct way to validate an e-mail address?
6 points
by
phwd
over 14 years ago
3 comments
jolan
over 14 years ago
Collapse
PHP makes it pretty easy:<p><pre><code> if (filter_var($email, FILTER_VALIDATE_EMAIL)) { $emailvalid = 1; }</code></pre>
评论 #2098249 未加载
presidentender
over 14 years ago
Collapse
I used one of those "close" regexes last time I needed to do this in C#. I believe I went with<p><pre><code> ^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.(?:[A-Z]{2,4}|museum)$</code></pre>
评论 #2103037 未加载
mike-cardwell
over 14 years ago
Do not roll your own. Use a library. You will miss stuff.