pref: 精准身份证中日期的约束(#78)

This commit is contained in:
any86 2020-04-10 23:36:03 +08:00
parent 4e164a4774
commit 8ce7d5e1e2
2 changed files with 4 additions and 4 deletions

View File

@ -266,12 +266,12 @@ vscode应用商店中搜索"**any-rule**".
### 身份证号(1代,15位数字)
```javascript
/^[1-9]\d{7}(0\d|10|11|12)([0-2]\d|30|31)\d{3}$/
/^[1-9]\d{7}(?:0\d|10|11|12)(?:0[1-9]|[1-2][\d]|30|31)\d{3}$/
```
### 身份证号(2代,18位数字),最后一位是校验位,可能为数字或字符X
```javascript
/^[1-9]\d{5}(18|19|20)\d{2}(0\d|10|11|12)([0-2]\d|30|31)\d{3}[\dXx]$/
/^[1-9]\d{5}(?:18|19|20)\d{2}(?:0\d|10|11|12)(?:0[1-9]|[1-2]\d|30|31)\d{3}[\dXx]$/
```
### 身份证号, 支持1/2代(15位/18位数字)

View File

@ -196,12 +196,12 @@ module.exports = [{
},
{
title: '身份证号(1代,15位数字)',
rule: /^[1-9]\d{7}(0\d|10|11|12)([0-2]\d|30|31)\d{3}$/,
rule: /^[1-9]\d{7}(?:0\d|10|11|12)(?:0[1-9]|[1-2][\d]|30|31)\d{3}$/,
examples: ['123456991010193']
},
{
title: '身份证号(2代,18位数字),最后一位是校验位,可能为数字或字符X',
rule: /^[1-9]\d{5}(18|19|20)\d{2}(0\d|10|11|12)([0-2]\d|30|31)\d{3}[\dXx]$/,
rule: /^[1-9]\d{5}(?:18|19|20)\d{2}(?:0\d|10|11|12)(?:0[1-9]|[1-2]\d|30|31)\d{3}[\dXx]$/,
examples: ['12345619991205131x']
},
{