Skip to content

Commit

Permalink
feat(isPassportNumber): fix regex for CN (#1686)
Browse files Browse the repository at this point in the history
  • Loading branch information
anirudhgiri committed Aug 20, 2021
1 parent 08b7ce3 commit 606c8cd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
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](?![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
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
2 changes: 1 addition & 1 deletion test/validators.js
Expand Up @@ -2476,12 +2476,12 @@ describe('Validators', () => {
'G25352389',
'E00160027',
'EA1234567',
'GB1234567',
],
invalid: [
'K0123456',
'E-1234567',
'G.1234567',
'GA1234567',
'EI1234567',
'GO1234567',
],
Expand Down

0 comments on commit 606c8cd

Please sign in to comment.