PHP example - How to write a regular expression which validates an email address?
PHP - How to write a regular expression which validates an email address?
To do this, you may use the following php function:
<?php
function IsValid($strEmail) {
if(eregi("^[a-z0-9._-]+@[a-z0-9._-]+.[a-z]{2,4}$", strEmail))
{
return true;
}
else
{
return false;
}
}
?>