From c3f018758ba745649c579fa3a22f446ddacf8090 Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Sat, 30 Oct 2021 11:57:11 +0200 Subject: [PATCH] fix: Russian passport number regex (#1810) * fix: Russian passport number regex fixes #1807 --- src/lib/isPassportNumber.js | 2 +- test/validators.js | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/lib/isPassportNumber.js b/src/lib/isPassportNumber.js index 949e38211..4c38bfbbe 100644 --- a/src/lib/isPassportNumber.js +++ b/src/lib/isPassportNumber.js @@ -50,7 +50,7 @@ const passportRegexByCountryCode = { PL: /^[A-Z]{2}\d{7}$/, // POLAND PT: /^[A-Z]\d{6}$/, // PORTUGAL RO: /^\d{8,9}$/, // ROMANIA - RU: /^\d{2}\d{2}\d{6}$/, // RUSSIAN FEDERATION + RU: /^\d{9}$/, // RUSSIAN FEDERATION SE: /^\d{8}$/, // SWEDEN SL: /^(P)[A-Z]\d{7}$/, // SLOVANIA SK: /^[0-9A-Z]\d{7}$/, // SLOVAKIA diff --git a/test/validators.js b/test/validators.js index 3ecb4491e..f3102f081 100644 --- a/test/validators.js +++ b/test/validators.js @@ -3078,14 +3078,16 @@ describe('Validators', () => { validator: 'isPassportNumber', args: ['RU'], valid: [ - '26 32 636829', - '0121 345321', - '4398636928', + '2 32 636829', + '012 345321', + '439863692', ], invalid: [ - 'AZ 2R YU46J', - '012A 3D5321', - 'SF233D532T', + 'A 2R YU46J0', + '01A 3D5321', + 'SF233D53T', + '12345678', + '1234567890', ], });