I'm trying to validate a email using the code below currently it tests the email to see if it matches the regex but even when a valid email is entered the error is activated and the page does not submit
$('#emailsubmit').submit(function() {
var email = new RegExp(/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/);
if (!("#emailAddr").match(email)) {
$("#errormsg").html("Please insert a valid email");
$("#errormsg").show();
var emailaddr = $("#emailAddr").val();
alert(emailaddr);
return false;
}
});