I'm trying to validate an email address and for the life of me I
cannot figure out why the following regex is not working:
<script language="php">
$email = "f.lastname@xxxxxxxxxxxxxxxx";
$regex =
"^([a-zA-Z0-9_\.\-\']+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-\']+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$";
if( ereg( $regex, $email )) {
echo 'Good email address';
} else {
echo 'Bad email address';
}
</script>
Does anyone have any ideas?
thnx,
Chris
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php