[thelist] Email Validator

Lachlan Cannon tiedefenderdelta6 at yahoo.com
Wed Dec 5 19:59:54 CST 2001


> 
> I use the following code:
> 
> function isValidEmail(str) {
>     if (!str.replace) {
>         // broswer does not support REs
>         return (str.indexOf("@") != -1);
>     }
>     else {
>         var re = new
>
RegExp("^\\s*[\\w\\-\\.]+\\@[\\w\\-]+(\\.[\\w\\-]+)+\\s*$");
>         return re.test(str);
>     }
> }
> 
> (I haven't included a ":port" part.)

Thanks for the refinements. I guess mine turned out so long
because of the way I thought about it (break it up into
smaller pieces, person name @ then either domain. whatever
or ip address), I'll be fixing mine up straight away.
Thanks again

Lachlan Cannon
{Luminosity}

__________________________________________________
Do You Yahoo!?
Send your FREE holiday greetings online!
http://greetings.yahoo.com




More information about the thelist mailing list