Hoo boy we have to do this all the time and a quick Google tells me everyone has their favorite little tricks. Some even work.
Here are the results of an exercise in email validation using two different PHP options, namely:
1 |
filter_var($email, FILTER_VALIDATE_EMAIL)); |
1 |
preg_match('/^([a-z0-9])(([-a-z0-9._])*([a-z0-9]))*\@([a-z0-9])*(\.([a-z0-9])([-a-z0-9_-])([a-z0-9])+)*$/i', $email); |
See demo page here…