diff --git a/README.md b/README.md
index 274acff48..a4f426aec 100644
--- a/README.md
+++ b/README.md
@@ -92,8 +92,8 @@ Validator | Description
**contains(str, seed [, options ])** | check if the string contains the seed.
`options` is an object that defaults to `{ ignoreCase: false, minOccurrences: 1 }`.
Options:
`ignoreCase`: Ignore case when doing comparison, default false
`minOccurences`: Minimum number of occurrences for the seed in the string. Defaults to 1.
**equals(str, comparison)** | check if the string matches the comparison.
**isAfter(str [, date])** | check if the string is a date that's after the specified date (defaults to now).
-**isAlpha(str [, locale, options])** | check if the string contains only letters (a-zA-Z).
Locale is one of `['ar', 'ar-AE', 'ar-BH', 'ar-DZ', 'ar-EG', 'ar-IQ', 'ar-JO', 'ar-KW', 'ar-LB', 'ar-LY', 'ar-MA', 'ar-QA', 'ar-QM', 'ar-SA', 'ar-SD', 'ar-SY', 'ar-TN', 'ar-YE', 'bg-BG', 'bn', 'cs-CZ', 'da-DK', 'de-DE', 'el-GR', 'en-AU', 'en-GB', 'en-HK', 'en-IN', 'en-NZ', 'en-US', 'en-ZA', 'en-ZM', 'es-ES', 'fa-IR', 'fi-FI', 'fr-CA', 'fr-FR', 'he', 'hi-IN', 'hu-HU', 'it-IT', 'ku-IQ', 'nb-NO', 'nl-NL', 'nn-NO', 'pl-PL', 'pt-BR', 'pt-PT', 'ru-RU', 'si-LK', 'sl-SI', 'sk-SK', 'sr-RS', 'sr-RS@latin', 'sv-SE', 'tr-TR', 'uk-UA']`) and defaults to `en-US`. Locale list is `validator.isAlphaLocales`. options is an optional object that can be supplied with the following key(s): ignore which can either be a String or RegExp of characters to be ignored e.g. " -" will ignore spaces and -'s.
-**isAlphanumeric(str [, locale, options])** | check if the string contains only letters and numbers (a-zA-Z0-9).
Locale is one of `['ar', 'ar-AE', 'ar-BH', 'ar-DZ', 'ar-EG', 'ar-IQ', 'ar-JO', 'ar-KW', 'ar-LB', 'ar-LY', 'ar-MA', 'ar-QA', 'ar-QM', 'ar-SA', 'ar-SD', 'ar-SY', 'ar-TN', 'ar-YE', 'bn', 'bg-BG', 'cs-CZ', 'da-DK', 'de-DE', 'el-GR', 'en-AU', 'en-GB', 'en-HK', 'en-IN', 'en-NZ', 'en-US', 'en-ZA', 'en-ZM', 'es-ES', 'fa-IR', 'fi-FI', 'fr-CA', 'fr-FR', 'he', 'hi-IN', 'hu-HU', 'it-IT', 'ku-IQ', 'nb-NO', 'nl-NL', 'nn-NO', 'pl-PL', 'pt-BR', 'pt-PT', 'ru-RU', 'si-LK', 'sl-SI', 'sk-SK', 'sr-RS', 'sr-RS@latin', 'sv-SE', 'tr-TR', 'uk-UA']`) and defaults to `en-US`. Locale list is `validator.isAlphanumericLocales`. options is an optional object that can be supplied with the following key(s): ignore which can either be a String or RegExp of characters to be ignored e.g. " -" will ignore spaces and -'s.
+**isAlpha(str [, locale, options])** | check if the string contains only letters (a-zA-Z).
Locale is one of `['ar', 'ar-AE', 'ar-BH', 'ar-DZ', 'ar-EG', 'ar-IQ', 'ar-JO', 'ar-KW', 'ar-LB', 'ar-LY', 'ar-MA', 'ar-QA', 'ar-QM', 'ar-SA', 'ar-SD', 'ar-SY', 'ar-TN', 'ar-YE', 'be-BY', 'bg-BG', 'bn', 'cs-CZ', 'da-DK', 'de-DE', 'el-GR', 'en-AU', 'en-GB', 'en-HK', 'en-IN', 'en-NZ', 'en-US', 'en-ZA', 'en-ZM', 'es-ES', 'fa-IR', 'fi-FI', 'fr-CA', 'fr-FR', 'he', 'hi-IN', 'hu-HU', 'it-IT', 'ku-IQ', 'nb-NO', 'nl-NL', 'nn-NO', 'pl-PL', 'pt-BR', 'pt-PT', 'ro-RO', 'ru-RU', 'si-LK', 'sl-SI', 'sk-SK', 'sr-RS', 'sr-RS@latin', 'sv-SE', 'tr-TR', 'uk-UA']`) and defaults to `en-US`. Locale list is `validator.isAlphaLocales`. options is an optional object that can be supplied with the following key(s): ignore which can either be a String or RegExp of characters to be ignored e.g. " -" will ignore spaces and -'s.
+**isAlphanumeric(str [, locale, options])** | check if the string contains only letters and numbers (a-zA-Z0-9).
Locale is one of `['ar', 'ar-AE', 'ar-BH', 'ar-DZ', 'ar-EG', 'ar-IQ', 'ar-JO', 'ar-KW', 'ar-LB', 'ar-LY', 'ar-MA', 'ar-QA', 'ar-QM', 'ar-SA', 'ar-SD', 'ar-SY', 'ar-TN', 'ar-YE', 'bn', 'be-BY', 'bg-BG', 'cs-CZ', 'da-DK', 'de-DE', 'el-GR', 'en-AU', 'en-GB', 'en-HK', 'en-IN', 'en-NZ', 'en-US', 'en-ZA', 'en-ZM', 'es-ES', 'fa-IR', 'fi-FI', 'fr-CA', 'fr-FR', 'he', 'hi-IN', 'hu-HU', 'it-IT', 'ku-IQ', 'nb-NO', 'nl-NL', 'nn-NO', 'pl-PL', 'pt-BR', 'pt-PT', 'ro-RO', 'ru-RU', 'si-LK', 'sl-SI', 'sk-SK', 'sr-RS', 'sr-RS@latin', 'sv-SE', 'tr-TR', 'uk-UA']`) and defaults to `en-US`. Locale list is `validator.isAlphanumericLocales`. options is an optional object that can be supplied with the following key(s): ignore which can either be a String or RegExp of characters to be ignored e.g. " -" will ignore spaces and -'s.
**isAscii(str)** | check if the string contains ASCII chars only.
**isBase32(str [, options])** | check if a string is base32 encoded. `options` is optional and defaults to `{crockford: false}`.
When `crockford` is true it tests the given base32 encoded string using [Crockford's base32 alternative](http://www.crockford.com/base32.html).
**isBase58(str)** | check if a string is base58 encoded.
diff --git a/src/lib/alpha.js b/src/lib/alpha.js
index c941c9bd7..134aeb27e 100644
--- a/src/lib/alpha.js
+++ b/src/lib/alpha.js
@@ -1,6 +1,7 @@
export const alpha = {
'en-US': /^[A-Z]+$/i,
'az-AZ': /^[A-VXYZÇƏĞİıÖŞÜ]+$/i,
+ 'be-BY': /^[ёа-зй-шы-яЁА-ЗЙ-ШЫІіЎў]+$/i,
'bg-BG': /^[А-Я]+$/i,
'cs-CZ': /^[A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]+$/i,
'da-DK': /^[A-ZÆØÅ]+$/i,
@@ -17,6 +18,7 @@ export const alpha = {
'hu-HU': /^[A-ZÁÉÍÓÖŐÚÜŰ]+$/i,
'pl-PL': /^[A-ZĄĆĘŚŁŃÓŻŹ]+$/i,
'pt-PT': /^[A-ZÃÁÀÂÄÇÉÊËÍÏÕÓÔÖÚÜ]+$/i,
+ 'ro-RO': /^[A-ZĂÂÎȘȚăâîșț]+$/i,
'ru-RU': /^[А-ЯЁ]+$/i,
'sl-SI': /^[A-ZČĆĐŠŽ]+$/i,
'sk-SK': /^[A-ZÁČĎÉÍŇÓŠŤÚÝŽĹŔĽÄÔ]+$/i,
@@ -39,6 +41,7 @@ export const alpha = {
export const alphanumeric = {
'en-US': /^[0-9A-Z]+$/i,
'az-AZ': /^[0-9A-VXYZÇƏĞİıÖŞÜ]+$/i,
+ 'be-BY': /^[0-9ёа-зй-шы-яЁА-ЗЙ-ШЫІіЎў]+$/i,
'bg-BG': /^[0-9А-Я]+$/i,
'cs-CZ': /^[0-9A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]+$/i,
'da-DK': /^[0-9A-ZÆØÅ]+$/i,
@@ -54,6 +57,7 @@ export const alphanumeric = {
'nn-NO': /^[0-9A-ZÆØÅ]+$/i,
'pl-PL': /^[0-9A-ZĄĆĘŚŁŃÓŻŹ]+$/i,
'pt-PT': /^[0-9A-ZÃÁÀÂÄÇÉÊËÍÏÕÓÔÖÚÜ]+$/i,
+ 'ro-RO': /^[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 a02006be9..653037423 100644
--- a/test/validators.js
+++ b/test/validators.js
@@ -1403,6 +1403,28 @@ describe('Validators', () => {
});
});
+ it('should validate belarusian alpha strings', () => {
+ test({
+ validator: 'isAlpha',
+ args: ['be-BY'],
+ valid: [
+ 'Прывітанне',
+ 'Дзякуй',
+ 'Дзякуй',
+ 'Выдатна',
+ 'Прабачце',
+ ],
+ invalid: [
+ 'abc1',
+ ' foo ',
+ 'Прывітанне123',
+ '123Дзякуй',
+ '',
+ ' ',
+ ],
+ });
+ });
+
it('should validate bulgarian alpha strings', () => {
test({
validator: 'isAlpha',
@@ -1748,6 +1770,27 @@ describe('Validators', () => {
});
});
+ it('should validate romanian alpha strings', () => {
+ test({
+ validator: 'isAlpha',
+ args: ['ro-RO'],
+ valid: [
+ 'Călătoresc',
+ 'astăzi',
+ 'frumoasă',
+ 'Bună',
+ 'Sâmbătă',
+ 'Duminică',
+ 'mână',
+ ],
+ invalid: [
+ '12řiď ',
+ 'blé!!',
+ 'föö!2!',
+ ],
+ });
+ });
+
it('should validate serbian cyrillic alpha strings', () => {
test({
validator: 'isAlpha',
@@ -2095,6 +2138,28 @@ describe('Validators', () => {
});
});
+ it('should validate belarusian alphanumeric strings', () => {
+ test({
+ validator: 'isAlphanumeric',
+ args: ['be-BY'],
+ valid: [
+ '123Прывітанне',
+ 'Дзякуй123',
+ '1Дзякуй',
+ 'Выдатна1',
+ '123Прабачце',
+ ],
+ invalid: [
+ 'abc1',
+ ' foo ',
+ '',
+ ' ',
+ '789 ',
+ 'hello000',
+ ],
+ });
+ });
+
it('should validate bulgarian alphanumeric strings', () => {
test({
validator: 'isAlphanumeric',
@@ -2304,6 +2369,27 @@ describe('Validators', () => {
});
});
+ it('should validate romanian alphanumeric strings', () => {
+ test({
+ validator: 'isAlphanumeric',
+ args: ['ro-RO'],
+ valid: [
+ '1Călătoresc',
+ 'astăzi2',
+ '3frumoasă',
+ 'Bună123',
+ '123Sâmbătă',
+ 'Duminică',
+ 'mână',
+ ],
+ invalid: [
+ ' ',
+ 'foo!!',
+ '123!',
+ ],
+ });
+ });
+
it('should validate spanish alphanumeric strings', () => {
test({
validator: 'isAlphanumeric',