I went with this regexp from Chris. Thank you all. Peter
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Aaron Fischer Sent: Thursday, March 01, 2007 11:03 AM To: NYPHP Talk Subject: Re: [nyphp-talk] RegExp Assistance I use the regexp from Chris's Essential PHP Security book: http://phpsecurity.org/ $email_pattern = '/[EMAIL PROTECTED]<&>]+@([ -a-z0-9]+\.)+[a-z]{2,}$/i'; if (preg_match($email_pattern, $yourEmailVar)) { echo 'It's good'; } else { echo 'There's a problem'; } Note, the echo's are thrown in for clarity, those aren't part of Chris's example code. =) Just ran it on your tom-cat example. Passes through ok. -Aaron On Mar 1, 2007, at 10:49 AM, Peter Sawczynec wrote: > I am currently using this regexp noted below to validate client- > side before the user submits so that > at least their email is well-formed: > > var emailRegxp = /^([\w]+)(.[\w]+)*@([\w]+)(.[\w]{2,3}){1,2}$/; > if( emailRegxp.test(strng) != true ){ > return false; > }else{ > return true; > } > > But, this regexp is not accepting emails of the form [EMAIL PROTECTED] > It is rejecting the hyphen in the domain name. > > Does anyone have a real-life tested simple regexp that would plug > into the > snippet above and be more complete? > _______________________________________________ New York PHP Community Talk Mailing List http://lists.nyphp.org/mailman/listinfo/talk NYPHPCon 2006 Presentations Online http://www.nyphpcon.com Show Your Participation in New York PHP http://www.nyphp.org/show_participation.php _______________________________________________ New York PHP Community Talk Mailing List http://lists.nyphp.org/mailman/listinfo/talk NYPHPCon 2006 Presentations Online http://www.nyphpcon.com Show Your Participation in New York PHP http://www.nyphp.org/show_participation.php