blog.x-e.ro / pure php email validation : using regular expressions

pure php email validation

php :: using regular expressions

<?php
$email = 'someone@somewhere.com';
if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) {
    //invalid email
} else {
    //valid email
}
?>
loading...

loading...