From 95a66ef0fb4b1fc88a7db2d9fac32930049ee392 Mon Sep 17 00:00:00 2001 From: kelvv Date: Sat, 26 Nov 2016 20:18:50 +0800 Subject: [PATCH] :bug: fix idCard check --- libs/checker.js | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/checker.js b/libs/checker.js index 53e2c7e..304bed2 100644 --- a/libs/checker.js +++ b/libs/checker.js @@ -52,7 +52,7 @@ checker.isEmail = function( content ){ * @param {string} content */ checker.isIDCard = function( content ){ - return /(?:^\d{15}$)|(?:^\d{17}(?:[0-9]|X)$)/.test(content); + return /^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}(?:[0-9]|X)$|^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$/.test(content); } /** diff --git a/package.json b/package.json index a5632d3..46aa272 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "regex-util", - "version": "1.0.3", + "version": "1.0.4", "description": "A tool for regex match in node.js,include phone,email,address......", "main": "index.js", "engines": {