Move the dash to the beginning of the [] block.  If that doesn't work 
escape it with a \ (\-).

--Ben

Rey Bango wrote:
> LOL. Thanks guys. FF's JS console is throwing an error though:
> 
> Error: missing ] after element list
> Source File: https://www.healthybuyersclub.com/scripts/emailcheck.js
> Line: 18, Column: 21
> Source Code:
> var 
> filter=[a-zA-Z0-9_-]@((?:\w+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
> 
> It looks like its pointing to either the underscore or dash after the 9.
> 
> Any ideas?
> 
> Rey...
> 
> Munson, Jacob wrote:
>> I agree with his suggestion, but since the code is doing a case
>> insensitive match, you don't need the 'A-Z'.  But I'm nitpicking.  ;)
>>
>>
>>> -----Original Message-----
>>> From: Ben Doom
>>> Sent: Monday, March 13, 2006 9:47 AM
>>>
>>> You'll want to replace all instances of \w left of the @ with 
>>> something 
>>> like [a-zA-Z0-9_-] (which is off the top of my head and may 
>>> need tweaking).
>>>
>>> --Ben
>>>
>>> Rey Bango wrote:
>>>
>>>> Guys I have the following javascript code that validates email 
>>>> addresses. The problem is that it won't accept an email 
>>> that has a dash 
>>>
>>>> in it (eg: [EMAIL PROTECTED]). Could someone give me 
>>> some help with 
>>>
>>>> the regex filter to get it to accept the dash? Thanks.
>>>>
>>>> //Advanced Email Check credit-
>>>> //By JavaScript Kit (www.javascriptkit.com)
>>>> //Over 200+ free scripts here!
>>>>
>>>> var invalidaddress=new Array()
>>>> /*
>>>> invalidaddress[0]="hotmail"
>>>> invalidaddress[1]="rocketmail"
>>>> invalidaddress[2]="yahoo"
>>>> invalidaddress[3]="zdnetmail"
>>>> */
>>>> //extend or shorten this list if neccessary
>>>>
>>>> var testresults
>>>> function isemail(chkemail){
>>>> var invalidcheck=0;
>>>> var str=chkemail
>>>> var 
>>>>
>>> filter=/^(\w+(?:\.\w+)*)@((?:\w+\.)*\w[\w-]{0,66})\.([a-z]{2,6
>>> }(?:\.[a-z]{2})?)$/i
>>>
>>>> if (filter.test(str)){
>>>> var tempstring=str.split("@")
>>>> tempstring=tempstring[1].split(".")
>>>> for (i=0;i<invalidaddress.length;i++){
>>>>    if (tempstring[0]==invalidaddress[i])
>>>>    invalidcheck=1
>>>>    }
>>>>    if (invalidcheck!=1)
>>>>            testresults=true
>>>>    else{
>>>>            alert("Please input a more official email address!")
>>>>            testresults=false
>>>>    }
>>>>    }
>>>>    else{
>>>>            alert("Please input a valid email address!")
>>>>            testresults=false
>>>>    }
>>>> return (testresults)
>>>> }
>>
>> This transmission may contain information that is privileged, confidential 
>> and/or exempt from disclosure under applicable law. If you are not the 
>> intended recipient, you are hereby notified that any disclosure, copying, 
>> distribution, or use of the information contained herein (including any 
>> reliance thereon) is STRICTLY PROHIBITED. If you received this transmission 
>> in error, please immediately contact the sender and destroy the material in 
>> its entirety, whether in electronic or hard copy format. Thank you. A1.
>>
>>
>>
>>
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:235223
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to