OldWilly
Programmer
- Mar 1, 2002
- 66
What do I need to change in the below filter to make a dash (-) valid on the left side of the address?
Ex: john-smith@xxx.com
function FormValidator(theForm)
{
if (theForm.email.value == "")
{
alert("Please enter your \"Email Address\".");
theForm.email.focus();
return (false);
}
str=theForm.email.value;
filter=/^(\w+(?:\.\w+)*)@((?:\w+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
if (filter.test(str)!=true)
{
alert("Please input a valid email address!");
theForm.email.focus();
return (false);
}
return (true);
}
Ex: john-smith@xxx.com
function FormValidator(theForm)
{
if (theForm.email.value == "")
{
alert("Please enter your \"Email Address\".");
theForm.email.focus();
return (false);
}
str=theForm.email.value;
filter=/^(\w+(?:\.\w+)*)@((?:\w+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
if (filter.test(str)!=true)
{
alert("Please input a valid email address!");
theForm.email.focus();
return (false);
}
return (true);
}