i have this function here:
function validateEmail($email){ return ereg("^[a-zA-Z0-9]+[a-zA-Z0-9_-]+@[a-zA-Z0-9]+[a-zA-Z0-9.-]+[a-zA-Z0-9]+.[a-z]{2,4}$", $email); }
ereg is deprecated and i don't know how to use preg_ instead any help?
function validateEmail($email){ return preg_match("/^[a-zA-Z0-9]+[a-zA-Z0-9_-]+@[a-zA-Z0-9]+[a-zA-Z0-9.-]+[a-zA-Z0-9]+.[a-z]{2,4}$/", $email); }
There's more to preg_match than that ... but this will return TRUE/FALSE ... which is what you want.
Then again, that regexp rejects valid e-mail addresses while allowing invalid ones, so you should probably just ditch it altogether and use something like [man]filter_var/man with the FILTER_VALIDATE_EMAIL flag.
thank you guys