I can't figure out where I'm going wrong here. Trying to validate an email address:
if (!preg_match("/^( [a-zA-Z0-9] )+( [a-zA-Z0-9\._-] )*@( [a-zA-Z0-9_-] )+( [a-zA-Z0-9\._-] +)+$/" , $emailREG)) {
I can't figure out where I'm going wrong here. Trying to validate an email address:
if (!preg_match("/^( [a-zA-Z0-9] )+( [a-zA-Z0-9\._-] )*@( [a-zA-Z0-9_-] )+( [a-zA-Z0-9\._-] +)+$/" , $emailREG)) {
Try using FILTER_VALIDATE_EMAIL instead:
<?php
$email = "someone@exa mple.com";
if(!filter_var($email, FILTER_VALIDATE_EMAIL)){
echo "E-mail is not valid";
}else{
echo "E-mail is valid";
}
?>