This article mainly introduces PHP's regular expressions for email verification. Interested friends can refer to it. I hope it will be helpful to everyone. The code is as follows:
class isEmail{ public function run($email){ if(ereg("^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+",$email)){ return true; }else{ return false; } } }$isEmail=new isEmail;if($isEmail->run("going")==false){ echo "email is wrong"; }
Related recommendations:
Reasons and solutions for failure of PHP regular matching of all characters
Based on PHP regular zero-width Detailed explanation of the use of assertions
PHP regular expressions (added 177 mobile phone number)
The above is the detailed content of PHP regular expression for email verification. For more information, please follow other related articles on the PHP Chinese website!