Re: eregi(mail)

From: Date: Fri, 10 May 2002 18:45:19 +0000
Subject: Re: eregi(mail)
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-96984@lists.php.net to get a copy of this message
Either Google is wrong (probably) or they are now allowing things like spaces into an email address. There are actually several things that are not allowed in a standard email address. Here is the code that I use. ereg('^[-!#$%&\'*+\\./0-9=?A-Z^_a-z{|}~]+'.'@'.'[-!#$%&\'*+\\/0-9=?A-Z^_a-z{|}~]+\.'.'[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$', $subarray)) I am honestly not sure where I got this code, but it has always worked for me and I have not found any YET that are good address that this kills. I have also not found any bad ones YET that this lets through (unless the domain or user doesn't exist, of course). Steve At 01:26 PM 5/10/2002, you wrote:
I had always been suspicious about email validators so I did a big long search on Google about standard address formats. It turns out that aside from the @ symbol emails have no standard format whatsoever. So ereg('@', $email) is really the only functional email validator. You also have to think about what kind of email validation you need. Do you really need to control the format of the emails being stored in your database? Or do you need to control the validity of the emails being stored in your database? There is a big difference. A valid email address isn't necessarily one that is formated in the way you expect. It is one that is active and can be mailed to. There are a number of techniques you can use to determine that. Well.. anyway sorry for going off on a tangent there. In your search for an email validator you got a bit more information than you expected. I hope it was useful in some tiny miniscule sort of way. :) -- Kevin Stone kevin@helpelf.com ----- Original Message ----- From: "Analysis & Solutions" <danielc@analysisandsolutions.com> To: "PHP List" <php-general@lists.php.net> Sent: Friday, May 10, 2002 10:59 AM Subject: Re: [PHP] eregi(mail) Hi Liam: On Fri, May 10, 2002 at 09:48:58AM -0700, Liam Gibbs wrote:
Does anyone have a decent eregi statement for validating e-mail addresses?
eregi('^[a-z0-9_.=+-]+@([a-z0-9-]+\.)+([a-z]{2,6})$', $Email); Enjoy, --Dan --
               PHP classes that make web design easier
        SQL Solution  |   Layout Solution   |  Form Solution
    sqlsolution.info  | layoutsolution.info |  formsolution.info
T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
 4015 7 Av #4AJ, Brooklyn NY     v: 718-854-0335     f: 718-854-0409
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.general (#96984) next »