SOLVED: Re: [thelist] JS regex help

Julian Rickards julian at jrickards.ca
Thu Oct 7 16:24:32 CDT 2004


Believe it or not, I have seen a .museum.

brian cummiskey wrote:

> 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