Re: How to ge the ones which are not

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.          |
`------------------------------------------------------------'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux