I have tried approximately all the regex solution but I am still able to bypass the validation for the below email -
I need to mark this email as invalid using Javascript
. Please share the correct regex that I can use to mark above email as invalid.
You can use this one from Regex101
I think your previous regex might accidentally include \.
inside character list with +
quantifier, so @xx..co
still can be bypass
var regex = /^[0-9a-zA-Z-_\$#]+@[0-9a-zA-Z-_\$#]+\.[a-zA-Z]{2,5}/;
console.log(regex.test('[email protected]'));