Home  >  Article  >  Backend Development  >  PHP regular expression for email verification

PHP regular expression for email verification

墨辰丷
墨辰丷Original
2018-05-15 16:28:153773browse

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn