Categories
PHP

E-mail address validation

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 e-mail validation using two different PHP options, namely: filter_var($email, FILTER_VALIDATE_EMAIL)); 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…