Skip to content

Commit

Permalink
🐛 fix idCard check
Browse files Browse the repository at this point in the history
  • Loading branch information
kelvv committed Nov 26, 2016
1 parent 67cfb9a commit 95a66ef
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion libs/checker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down

0 comments on commit 95a66ef

Please sign in to comment.