3 ms·
What is the most correct way to validate an e-mail address?
- presidentender 16y agoI used one of those "close" regexes last time I needed to do this in C#. I believe I went with ^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.(?:[A-Z]{2,4}|museum)$
- mike-cardwell 16y agobill.o'reilly@example.com
- jolan 16y agoPHP makes it pretty easy: if (filter_var($email, FILTER_VALIDATE_EMAIL)) { $emailvalid = 1; }
- prodigal_erik 16y agohttp://bugs.php.net/bug.php?id=43402 http://bugs.php.net/bug.php?id=43402 claims PHP is using an unmaintained regexp that gives incorrect results.
- mike-cardwell 16y agoDo not roll your own. Use a library. You will miss stuff.