This is my function,
function validateEmail(email) {
var re = /^(([^<>()[\]\\.,;:\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,}))$/;
return re.test(email);
}
JsLint Throws unescaped '[' in re declaration ! is there anything wrong with the construction of regex ?
In the first part of your regex ( [^<>()[\\]\\\\.,;:\\s@\\"]+
), you may need to escape the inner [
:
[^<>()\[\]\\.,;:\s@\"]+
^
This must be done in the next part of your regex as well.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.