Hi all,
I have written a function for accepting name and should be atleast minimum 4 characters.
It is accepting all characters including special characters.
Now i want my function to accept only a-z0-9 and _(underscore),-(hyphen)
and .(dot)
Below is my function

function checkName(form) /* for real name verification */
{
if (form.realname.value == '')
{
alert('Error: Username cannot be blank!');
form.realname.focus();
return false;
}
else if(form.realname.value.length < 4)
{
alert("UserName should be atleast 4 characters long");
return false;
}

return true;
}