Possible Duplicate:
What is the best regular expression for validating email addresses?
Hi All,
I have this regex/code to validate a email address:
var testEmail = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
if ( testEmail.test(oForm["email"]) == false){
chErrorMessage += "\nValid email address";
bSubmit = false;
}
The code doesn't seem to be doing the test correctly, whether the email is formatted correctly or not.
I'm a beginner at JavaScript. Any help would be greatly appreciated, Thanks