Can someone explain to me? This is my code :
$regex = '/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+'
. '(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/';
if (preg_match($regex, $email)) {
echo $email . " is a valid email. We can accept it.";
} else {
echo $email . " is an invalid email. Please try again.";
}
If I use for an example this regular expression:
^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)↪*(\.[a-z]{2,3})$
or another different regular expression I get:
preg_match() [function.preg-match]: No ending delimiter '^' found
And if I use filter_var('some_regular_expression', FILTER_EMAIL_VALIDATOR)
an email like asd!qwe@gmail.com
is a valid one ???