Re: Why would this eregi() function not work?

From: Date: Fri, 14 Nov 2003 03:57:23 +0000
Subject: Re: Why would this eregi() function not work?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-169615@lists.php.net to get a copy of this message
Dave G wrote:
PHP Gurus, I have an eregi() function that I'm using to validate emails that users enter into a form. I pretty much took it directly from the book "PHP and MySQL Web Development". It looks like this: (!eregi('^[a-zA-Z0-9_\-\.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$', $email)
1. Special characters within brackets do not need to be escaped. [.] will match a period. 2. If you're going to include a hyphen within brackets, it needs to be the last character, otherwise you're signifying a range. [a-z] is a through z. [a-] is a or a hyphen. 3. I don't think a hyphen is even legal in an email address... ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals – www.phparch.com

« previous php.general (#169615) next »