The Daily WTF had a regular expression recently on their page that was supposed to be the be-all end-all for email validation.

http://thedailywtf.com/Articles/Validating_Email_Addresses.aspx

It's near the bottom of the page. The comments have a lot more examples and discussion about email validation in general.

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] <mailto:[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? Thanks to all. Warmest regards, Peter Sawczynec
Technology Dir.
Sun-code.com
Web related services
646.316.3678
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>

------------------------------------------------------------------------

_______________________________________________
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

Reply via email to