From a1d3fc141e03c4b00b629644630190ecfd819504 Mon Sep 17 00:00:00 2001 From: JSANN Date: Wed, 3 Dec 2014 12:50:50 +0800 Subject: [PATCH] Update validator.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 之前的正则有bug,a@aaaa可以验证通过 --- validator.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/validator.js b/validator.js index ed2ace6..cf15f74 100755 --- a/validator.js +++ b/validator.js @@ -16,7 +16,7 @@ // $item: {}, email: function (text) { - return /^(?:[a-z0-9]+[_\-+.]+)*[a-z0-9]+@(?:([a-z0-9]+-?)*[a-z0-9]+.)+([a-z]{2,})+$/i.test(text) + return /^(([^<>()[\]\\.,;:\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,}))$/i.test(text) }, // 仅支持 8 种类型的 day