I have JavaScript that validates whole email once entered:
function ValidateEmail(inputText)
{
var mailformat = /^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/
if(inputText.value.match(mailformat))
{
alert("This is not a valid email address");
return false;
}
}
But how to check if single character is valid for email? So I want to prevent users to enter bad email characters. So function param would be these and should return false only if invalid character present:
m
my
mya
....
myaddress
....
myaddress@mail.com