Skip to content

Commit 606c8cd

Browse files
committed
feat(isPassportNumber): fix regex for CN (#1686)
1 parent 08b7ce3 commit 606c8cd

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/lib/isPassportNumber.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const passportRegexByCountryCode = {
1717
BY: /^[A-Z]{2}\d{7}$/, // BELARUS
1818
CA: /^[A-Z]{2}\d{6}$/, // CANADA
1919
CH: /^[A-Z]\d{7}$/, // SWITZERLAND
20-
CN: /^[GE](?![IO])[A-Z0-9]\d{7}$/, // CHINA [G=Ordinary, E=Electronic] followed by 8-digits, or an UPPERCASE letter (except I and O) followed by 7 digits
20+
CN: /^G\d{8}$|^E(?![IO])[A-Z0-9]\d{7}$/, // CHINA [G=Ordinary, E=Electronic] followed by 8-digits, or E followed by any UPPERCASE letter (except I and O) followed by 7 digits
2121
CY: /^[A-Z](\d{6}|\d{8})$/, // CYPRUS
2222
CZ: /^\d{8}$/, // CZECH REPUBLIC
2323
DE: /^[CFGHJKLMNPRTVWXYZ0-9]{9}$/, // GERMANY

test/validators.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2476,12 +2476,12 @@ describe('Validators', () => {
24762476
'G25352389',
24772477
'E00160027',
24782478
'EA1234567',
2479-
'GB1234567',
24802479
],
24812480
invalid: [
24822481
'K0123456',
24832482
'E-1234567',
24842483
'G.1234567',
2484+
'GA1234567',
24852485
'EI1234567',
24862486
'GO1234567',
24872487
],

0 commit comments

Comments
 (0)