I have a script written long ago by a freelancer that's worked fine until now. The script simply checks the email address from a form against some matching rules and returns true/false. Problem is for some reason it isn't recognizing an email address that has a very simple firstInitialLastName@domain.com syntax (no extra periods or characters, etc).
I don't understand javascript as well as I understand PHP so if someone could tell me why this script would return false against an email address formatted like I indicated above, I'd greatly appreciate it.
function check_email(str) {
var re = /^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/;
if (!str.match(re)) {
return false;
} else {
return true;
}
}