Skip to content

Commit

Permalink
feat(isPassportNumber): fix regex for CN (#1714)
Browse files Browse the repository at this point in the history
* fix: (isPassportNumber) fix regex for CN

* feat(isPassportNumber): fix regex for CN (#1686)
  • Loading branch information
anirudhgiri committed Sep 26, 2021
1 parent b0d49bd commit 69881b6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/isPassportNumber.js
Expand Up @@ -17,7 +17,7 @@ const passportRegexByCountryCode = {
BY: /^[A-Z]{2}\d{7}$/, // BELARUS
CA: /^[A-Z]{2}\d{6}$/, // CANADA
CH: /^[A-Z]\d{7}$/, // SWITZERLAND
CN: /^[GE]\d{8}$/, // CHINA [G=Ordinary, E=Electronic] followed by 8-digits
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
CY: /^[A-Z](\d{6}|\d{8})$/, // CYPRUS
CZ: /^\d{8}$/, // CZECH REPUBLIC
DE: /^[CFGHJKLMNPRTVWXYZ0-9]{9}$/, // GERMANY
Expand Down
6 changes: 6 additions & 0 deletions test/validators.js
Expand Up @@ -2475,9 +2475,15 @@ describe('Validators', () => {
valid: [
'G25352389',
'E00160027',
'EA1234567',
],
invalid: [
'K0123456',
'E-1234567',
'G.1234567',
'GA1234567',
'EI1234567',
'GO1234567',
],
});

Expand Down

0 comments on commit 69881b6

Please sign in to comment.