How can I validate a regular expression in JavaScript?
I have this validation injavaScript
if ($("#nombre").val() == (/[A-Za-z0-9-\s+@+.+-]/)) {
alert('No puedes ingresar caracteres especiales');
}
Well that's what I'm trying to do
How can I achieve to compare special characters injavaScript
You can use the RegExp;
test()
and this format /[`!@#$%^&*()_+-=[]{};':"\|,.<>/?~]/ for special characters.I think that expression is wrong to begin with. To validate an email for example you can do something like this:
There and what would remain is to find the correct regular expression