Re: How to ge the ones which are not

From: Date: Fri, 11 Mar 2005 20:44:59 +0000
Subject: Re: How to ge the ones which are not
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-210549@lists.php.net to get a copy of this message
On Fri, 2005-03-11 at 13:12, Richard Lynch wrote: > > I've built this little regular expression to test wether an e-mail > > address is valid or not: > > > > if(eregi > > > > ("^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$", > > $email)) > > First, you should be aware that your RegEx is wrong. > > I know it's wrong, because the CORRECT Regex is 3 *PAGES* long in the > camel book. If it's the one by Friedl it's not correct either unless he found some way past the nesting limitation of regex. In which case why go for a 3 page "almost works" solution when you can go for a one line "almost works" solution that will catch 99.99999% (guess) of valid email addresses. It's doubtful anyone (in their right mind anyways) would rely solely on an email address for anything secure. At the very least they would send an email to the given address and request verification that the recipient owns it. Cheers, Rob. -- .------------------------------------------------------------. | InterJinn Application Framework - http://www.interjinn.com | :------------------------------------------------------------: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `------------------------------------------------------------'

« previous php.general (#210549) next »