diff --git a/src/lib/alpha.js b/src/lib/alpha.js index b40b43536..c708861cc 100644 --- a/src/lib/alpha.js +++ b/src/lib/alpha.js @@ -13,7 +13,7 @@ export const alpha = { 'nn-NO': /^[A-ZÆØÅ]+$/i, 'hu-HU': /^[A-ZÁÉÍÓÖŐÚÜŰ]+$/i, 'pl-PL': /^[A-ZĄĆĘŚŁŃÓŻŹ]+$/i, - 'pt-PT': /^[A-ZÃÁÀÂÇÉÊÍÕÓÔÚÜ]+$/i, + 'pt-PT': /^[A-ZÃÁÀÂÄÇÉÊËÍÏÕÓÔÖÚÜ]+$/i, 'ru-RU': /^[А-ЯЁ]+$/i, 'sl-SI': /^[A-ZČĆĐŠŽ]+$/i, 'sk-SK': /^[A-ZÁČĎÉÍŇÓŠŤÚÝŽĹŔĽÄÔ]+$/i, @@ -43,7 +43,7 @@ export const alphanumeric = { 'nl-NL': /^[0-9A-ZÁÉËÏÓÖÜÚ]+$/i, 'nn-NO': /^[0-9A-ZÆØÅ]+$/i, 'pl-PL': /^[0-9A-ZĄĆĘŚŁŃÓŻŹ]+$/i, - 'pt-PT': /^[0-9A-ZÃÁÀÂÇÉÊÍÕÓÔÚÜ]+$/i, + 'pt-PT': /^[0-9A-ZÃÁÀÂÄÇÉÊËÍÏÕÓÔÖÚÜ]+$/i, 'ru-RU': /^[0-9А-ЯЁ]+$/i, 'sl-SI': /^[0-9A-ZČĆĐŠŽ]+$/i, 'sk-SK': /^[0-9A-ZÁČĎÉÍŇÓŠŤÚÝŽĹŔĽÄÔ]+$/i, diff --git a/test/validators.js b/test/validators.js index c920d4877..0b967833f 100644 --- a/test/validators.js +++ b/test/validators.js @@ -994,6 +994,26 @@ describe('Validators', () => { }); }); + it('should validate portuguese alpha strings', () => { + test({ + validator: 'isAlpha', + args: ['pt-PT'], + valid: [ + 'palíndromo', + 'órgão', + 'qwértyúão', + 'àäãcëüïÄÏÜ', + ], + invalid: [ + '12abc', + 'Heiß', + 'Øre', + 'æøå', + '', + ], + }); + }); + it('should validate italian alpha strings', () => { test({ validator: 'isAlpha', @@ -1466,6 +1486,26 @@ describe('Validators', () => { }); }); + it('should validate portuguese alphanumeric strings', () => { + test({ + validator: 'isAlphanumeric', + args: ['pt-PT'], + valid: [ + 'palíndromo', + '2órgão', + 'qwértyúão9', + 'àäãcë4üïÄÏÜ', + ], + invalid: [ + '!abc', + 'Heiß', + 'Øre', + 'æøå', + '', + ], + }); + }); + it('should validate italian alphanumeric strings', () => { test({ validator: 'isAlphanumeric',