[thelist] JS regex help

Edwin Horneij ed_horneij at yahoo.com
Thu Oct 7 16:18:00 CDT 2004


--- Maximillian Schwanekamp <lists at neptunewebworks.com> wrote:

> brian cummiskey wrote:
> 
> > function validateEmail( strValue) {
> > var objRegExp  = 
> >
>
/(^[a-z]([a-z_\.]*)@([a-z_\.]*)([.][a-z]{3})$)|(^[a-z]([a-z_\.]*)@([a-z_\.]*)(\.[a-z]{3})(\.[a-z]{2})*$)/i;
> 
> >
> >   return objRegExp.test(strValue);
> > }
> > the function works great- but it doesn't check for non-tld domains,
> 
> > such as .cc, .info to name a couple.
> 
> Try this (untested):
> var objRegExp  = 
>
/(^[a-z]([a-z_\.]*)@([a-z_\.]*)([.][a-z]{3})$)|(^[a-z]([a-z_\.]*)@([a-z_\.]*)(\.[a-z]{2,4})(\.[a-z]{2})*$)/i;
> Note the {2,4} is the only change.

Better make it "{2,6}". ".museum" is a TLD.



		
_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com


More information about the thelist mailing list