Home  >  Article  >  Backend Development  >  Regular expression to verify email address

Regular expression to verify email address

WBOY
WBOYOriginal
2016-07-25 08:45:331092browse
  1. $email = "test@ansoncheung.com";
  2. if (preg_match('/^[^0-9][a-zA-Z0-9_]+([.][a-zA-Z0- 9_]+)*[@][a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)*[.][a-zA-Z]{2,4}$ /',$email)) {
  3. echo "Your email is ok.";
  4. } else {
  5. echo "Wrong email address format";
  6. }
Copy code

Regular expression, email


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