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

PHP regular expression for email verification

墨辰丷
Release: 2023-03-25 20:32:02
Original
3796 people have browsed it

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";
		}
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template