NYCPHP Meetup

NYPHP.org

[nycphp-talk] RegExp Assistance

Peter Sawczynec ps at sun-code.com
Thu Mar 1 10:49:10 EST 2007


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 name at tom-cat.com
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 
ps at sun-code.com
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20070301/c7e2bce5/attachment.html>


More information about the talk mailing list