diff --git a/src/lib/isIBAN.js b/src/lib/isIBAN.js index cb753acf6..5b6da5952 100644 --- a/src/lib/isIBAN.js +++ b/src/lib/isIBAN.js @@ -94,12 +94,12 @@ const ibanRegexThroughCountryCode = { * @return {boolean} */ function hasValidIbanFormat(str) { - // Strip white spaces and hyphens, keep only digits and A-Z latin alphabetic - const strippedStr = str.replace(/[^A-Z0-9]+/gi, '').toUpperCase(); + // Strip white spaces and hyphens + const strippedStr = str.replace(/[\s\-]+/gi, '').toUpperCase(); const isoCountryCode = strippedStr.slice(0, 2).toUpperCase(); return (isoCountryCode in ibanRegexThroughCountryCode) && - ibanRegexThroughCountryCode[isoCountryCode].test(strippedStr); + ibanRegexThroughCountryCode[isoCountryCode].test(strippedStr); } /** diff --git a/test/validators.js b/test/validators.js index 9762d84de..999484852 100644 --- a/test/validators.js +++ b/test/validators.js @@ -3823,6 +3823,9 @@ describe('Validators', () => { invalid: [ 'XX22YYY1234567890123', 'FR14 2004 1010 0505 0001 3', + 'FR7630006000011234567890189@', + 'FR7630006000011234567890189๐Ÿ˜…', + 'FR763000600001123456!!๐Ÿคจ7890189@', ], }); });