Re: ereg matching email address

From: Date: Wed, 06 Sep 2000 16:14:04 +0000
Subject: Re: ereg matching email address
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-15542@lists.php.net to get a copy of this message
At 16:23 6-9-00 +0100, David Newcomb wrote:
Even better, try: if ($email != "" && !ereg('^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+'. '@'. '[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.'. '[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$', $email))
    echo "Invalid email address";
        function Validate_Email ($email) {
                return(preg_match("'^[a-z0-9_.=-]+@(?:[a-z0-9-]+\.)+([a-z]{2,3})\$'i", $email));
        }
hth, David. ----- Original Message ----- From: Jochen Kächelin <info@bemorph.de> To: GENERAL LIST <php-general@lists.php.net> Sent: Wednesday, September 06, 2000 1:40 PM Subject: AW: [PHP] ereg matching email address try this function: function checkemail($email) { if (eregi("(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)", $email) || !eregi ("^.+\@(\[?)[-a-zA-Z0-9\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$",
                      $email)) {     return(false);   }
else  {     list($user, $domain) = explode("@", $email);
                        if ((!eregi("^[a-zA-Z0-9\.\-]+$", $user))
||(!eregi("^[a-zA-Z0-9\.\-]+$", $domain))) {
                      return false;  }
else {return(true); }
                      }
}
-----Ursprngliche Nachricht----- Von: Monte Ohrt [mailto:monte@ispi.net] Gesendet am: Dienstag, 5. September 2000 23:24 An: php-general@lists.php.net; kris@grinz.com Betreff: Re: [PHP] ereg matching email address You can port it from perl if you wish :-) http://public.yahoo.com/~jfriedl/regex/email-opt.pl
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net


« previous php.general (#15542) next »