(preg_match('/^[A-Z0-9._-]+@[A-Z0-9.-]+\.[A-Z]{2,6}$/i', $data))
(preg_match("/^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,6}$/i", $email_address))
If someone need it.. It validates a birth date in format JJMMAAAA
<?php
if (preg_match("/
^(0[1-9]|[1-2]{1}[0-9]{1}|3[0-1]{1})
(0[1-9]{1}|1[0-2]{1})
(19[\d]{2}|200[0-5])$/", $date)
echo "Ok" ;
?>
A very simple Phone number validation function.
Returns the Phone number if the number is in the xxx-xxx-xxxx format. x being 0-9.
Returns false if missing digits or improper characters are included.
<?
function VALIDATE_USPHONE($phonenumber)
{
if ( (preg_match("/^[0-9]{3,3}[-]{1,1}[0-9]{3,3}[-]{1,1}
[0-9]{4,4}$/", $phonenumber) ) == TRUE ) {
return $phonenumber;
} else {
return false;
}
}
?>
ecc... ecc... su:
http://it2.php.net/manual/it/function.preg-match.php