Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix: (isPassportNumber) fix regex for CN
  • Loading branch information
anirudhgiri committed Aug 20, 2021
commit 08b7ce3a2cbb7b442bca43014767a26f6460bed5
2 changes: 1 addition & 1 deletion src/lib/isPassportNumber.js
Original file line number Diff line number Diff line change
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: /^[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
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
Original file line number Diff line number Diff line change
Expand Up @@ -2475,9 +2475,15 @@ describe('Validators', () => {
valid: [
'G25352389',
'E00160027',
'EA1234567',
'GB1234567',
],
invalid: [
'K0123456',
'E-1234567',
'G.1234567',
'EI1234567',
'GO1234567',
],
});

Expand Down