I am using razor view in my application.I am trying to validate my mailID.I got email pattern format like,\[code\] function validateEmail(mail) { var emailPattern = var emailPattern = /^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/; if (emailPattern.test(mail) == false) { $("#emailvalidation").text("Email is not in correct format"); } else if (emailPattern.test(mail) == true) { } }\[/code\]but If I give this in my function,It is displaying error at the "@" symbol.can any one help me,how to fix this.