Re: Re: Quick email address check

From: Date: Mon, 31 Mar 2008 02:24:12 +0000
Subject: Re: Re: Quick email address check
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-272322@lists.php.net to get a copy of this message
I have used this to good effect function isEmail($email) {
     if
(eregi("^[a-z0-9]+([-_\.]?[a-z0-9])+@[a-z0-9]+([-_\.]?[a-z0-9])+\.[a-z]{2,4}",$email)) {
          return TRUE;
} else {
          return FALSE;
     }
}//end function
I often have a '+' in my email address (which is perfectly valid) and it really annoys me when a site refuses to accept it.
Didn't notice this before but that regex ignores valid TLD's too like .museum, .travel .. Probably not that common but certainly valid. http://en.wikipedia.org/wiki/List_of_Internet_top-level_domains -- Postgresql & php tutorials http://www.designmagick.com/

« previous php.general (#272322) next »