We Recommend

Wicked Cool PHP: Real-World Scripts That Solve Difficult Problems Wicked Cool PHP: Real-World Scripts That Solve Difficult Problems
Wicked Cool PHP contains a wide variety of scripts to process credit cards, check the validity of email addresses, template HTML, and serve dynamic images and text.


Posted By

leandemon on 03/06/08


Tagged

email php validation validate


Versions (?)


Who likes this?

2 people have marked this snippet as a favorite

Wiederkehr
dbug13


Validate Email


Published in: PHP 


  1. function validate_email($email)
  2. {
  3. return eregi("^([_a-z0-9-]+)(\.[_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2,6})$", $email);
  4. }

Report this snippet 

Comments

RSS Icon Subscribe to comments
Posted By: koncept on April 14, 2008

.museum is a valid domain. Your regular expression should account for it. e.g. {2,6}

You need to login to post a comment.