I just use a simple Javascript function. I figure if it's remotely close, then good, if not then it's going to be an invalid email address most likely anyways:
function emailCheck(str) { var at="@" var dot="." var lat=str.indexOf(at) var lstr=str.length var ldot=str.indexOf(dot) if (str.indexOf(at)==-1){ return false } if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){ return false } if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){ return false } if (str.indexOf(at,(lat+1))!=-1){ return false } if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){ return false } if (str.indexOf(dot,(lat+2))==-1){ return false } if (str.indexOf(" ")!=-1){ return false } return true } DÆVID. "A good friend will come and bail you out of jail...but a true friend will be sitting next to you in the holding cell, laughing and saying -'That was fucking awesome!'" > -----Original Message----- > From: Manuel Lemos [mailto:[EMAIL PROTECTED]] > Sent: Sunday, January 12, 2003 9:30 PM > To: [EMAIL PROTECTED] > Subject: [PHP] Re: Favorite Email validation routine? > > > Hello, > > On 01/13/2003 03:21 AM, Peter Janett wrote: > > I'm looking for everyone's favorite email syntax validation > routine. Code > > that takes an email address and does regex on it to > determine if it's > > formatted correctly. > > > > I know there are some on phpclasses.org that actually check > the mx record > > and server of the domain, but I'm just looking for a good, > clean and fast > > email address syntax check. > > > > So, what is your favorite bit of code to do that? > > This class that I don't know if you seen also comes with > complex regex > for simple e-mail address validation: > http://www.phpclasses.org/emailvalidation -- Regards, Manuel Lemos -- 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