You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This regex in English means: the string must start with exactly 2 uppercase letters from A-Z, followed by exactly 6 digits, and then the end of the string.
This could be fixed by modifying the existing regular expression to be: CA: /^[A-Z]{2}\d{6}$|^[A-Z]\d{6}[A-Z]{2}$/, // CANADA
Reproductions
If applicable, provide a reproduction on platforms like runkit
Additional context
Validator.js version: 13.12.0
Node.js version: any
OS platform: any
Describe the bug
The
isPassport
function does not support the new Canadian Passport Number format.Currently,
isPassport
only supports the old format of: 2 letters, followed by exactly 6 digits, represented by the regex (/^[A-Z]{2}\d{6}$/
).The new Canadian Passport Number format is: 1 letter, 6 numbers, and 2 letters.
Examples
src/lib/isPassportNumber.js
line 19CA: /^[A-Z]{2}\d{6}$/, // CANADA
This regex in English means: the string must start with exactly 2 uppercase letters from A-Z, followed by exactly 6 digits, and then the end of the string.
This could be fixed by modifying the existing regular expression to be:
CA: /^[A-Z]{2}\d{6}$|^[A-Z]\d{6}[A-Z]{2}$/, // CANADA
Reproductions
If applicable, provide a reproduction on platforms like runkit
Additional context
Validator.js version: 13.12.0
Node.js version: any
OS platform: any
Sources
The text was updated successfully, but these errors were encountered: