SOLVED: Re: [thelist] JS regex help
brian cummiskey
brian at hondaswap.com
Thu Oct 7 15:51:40 CDT 2004
Maximillian Schwanekamp 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.
Perfect- that did the trick.
Now, let's just hope there's no non-TLD's with a 5-letter suffix
(although, .co.uk tested positive, as did other double-dot domains with
both between 2 and 4)
Thanks Maxamillian =)
More information about the thelist
mailing list