I have the following email-validator in my javascript, but the @ is getting misinterpreted in MVC3:
function validateEmail(emailAddress) {
var emailPattern = "/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/";
return emailPattern.test(emailAddress);
}
Is there a way around this? I've tried using slashes to escape the at sign, but that didn't work.
function validateEmail(emailAddress) {
var emailPattern = "/^[a-zA-Z0-9._-]+@@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/";
return emailPattern.test(emailAddress);
}
@@ escapes @
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With