diff --git a/README.md b/README.md
index d074f8dab..2cf6505be 100644
--- a/README.md
+++ b/README.md
@@ -146,7 +146,7 @@ Validator | Description
**isMagnetURI(str)** | check if the string is a [magnet uri format](https://en.wikipedia.org/wiki/Magnet_URI_scheme).
**isMD5(str)** | check if the string is a MD5 hash.
Please note that you can also use the `isHash(str, 'md5')` function. Keep in mind that MD5 has some collision weaknesses compared to other algorithms (e.g., SHA).
**isMimeType(str)** | check if the string matches to a valid [MIME type](https://en.wikipedia.org/wiki/Media_type) format
-**isMobilePhone(str [, locale [, options]])** | check if the string is a mobile phone number,
(locale is either an array of locales (e.g `['sk-SK', 'sr-RS']`) OR one of `['am-Am', 'ar-AE', 'ar-BH', 'ar-DZ', 'ar-EG', 'ar-IQ', ar-JO', 'ar-KW', 'ar-SA', 'ar-SY', 'ar-TN', 'az-AZ', 'az-LY', 'az-LB', 'bs-BA', 'be-BY', 'bg-BG', 'bn-BD', 'ca-AD', 'cs-CZ', 'da-DK', 'de-DE', 'de-AT', 'de-CH', 'de-LU', 'el-GR', 'en-AU', 'en-BM', 'en-CA', 'en-GB', 'en-GG', 'en-GH', 'en-HK', 'en-MO', 'en-IE', 'en-IN', 'en-KE', 'en-MT', 'en-MU', 'en-NG', 'en-NZ', 'en-PK', 'en-PH', 'en-RW', 'en-SG', 'en-SL', 'en-UG', 'en-US', 'en-TZ', 'en-ZA', 'en-ZM', 'en-ZW', 'es-AR', 'es-BO', 'es-CL', 'es-CO', 'es-CR', 'es-CU', 'es-DO', 'es-HN', 'es-PE', 'es-EC', 'es-ES', 'es-MX', 'es-PA', 'es-PY', 'es-UY', 'es-VE', 'et-EE', 'fa-IR', 'fi-FI', 'fj-FJ', 'fo-FO', 'fr-BE', 'fr-FR', 'fr-GF', 'fr-GP', 'fr-MQ', 'fr-RE', 'ga-IE', 'he-IL', 'hu-HU', 'id-ID', 'it-IT', 'it-SM', 'ja-JP', 'ka-GE', 'kk-KZ', 'kl-GL', 'ko-KR', 'lt-LT', 'ms-MY', ''mz-MZ', nb-NO', 'ne-NP', 'nl-BE', 'nl-NL', 'nn-NO', 'pl-PL', 'pt-BR', 'pt-PT', 'pt-AO', 'ro-RO', 'ru-RU', 'si-LK' 'sl-SI', 'sk-SK', 'sq-AL', 'sr-RS', 'sv-SE', 'tg-TJ', 'th-TH', 'tr-TR', 'uk-UA', 'uz-UZ', 'vi-VN', 'zh-CN', 'zh-HK', 'zh-MO', 'zh-TW', 'dz-BT']` OR defaults to 'any'. If 'any' or a falsey value is used, function will check if any of the locales match).
`options` is an optional object that can be supplied with the following keys: `strictMode`, if this is set to `true`, the mobile phone number must be supplied with the country code and therefore must start with `+`. Locale list is `validator.isMobilePhoneLocales`.
+**isMobilePhone(str [, locale [, options]])** | check if the string is a mobile phone number,
(locale is either an array of locales (e.g `['sk-SK', 'sr-RS']`) OR one of `['am-Am', 'ar-AE', 'ar-BH', 'ar-DZ', 'ar-EG', 'ar-IQ', ar-JO', 'ar-KW', 'ar-PS', 'ar-SA', 'ar-SY', 'ar-TN', 'az-AZ', 'az-LY', 'az-LB', 'bs-BA', 'be-BY', 'bg-BG', 'bn-BD', 'ca-AD', 'cs-CZ', 'da-DK', 'de-DE', 'de-AT', 'de-CH', 'de-LU', 'dv-MV', 'el-GR', 'en-AU', 'en-BM', 'en-BW', 'en-CA', 'en-GB', 'en-GG', 'en-GH', 'en-GY', 'en-HK', 'en-MO', 'en-IE', 'en-IN', 'en-KE', 'en-KI', 'en-MT', 'en-MU', 'en-NG', 'en-NZ', 'en-PK', 'en-PH', 'en-RW', 'en-SG', 'en-SL', 'en-UG', 'en-US', 'en-TZ', 'en-ZA', 'en-ZM', 'en-ZW', 'es-AR', 'es-BO', 'es-CL', 'es-CO', 'es-CR', 'es-CU', 'es-DO', 'es-HN', 'es-PE', 'es-EC', 'es-ES', 'es-MX', 'es-PA', 'es-PY', 'es-SV', 'es-UY', 'es-VE', 'et-EE', 'fa-IR', 'fi-FI', 'fj-FJ', 'fo-FO', 'fr-BE', 'fr-BF', 'fr-FR', 'fr-GF', 'fr-GP', 'fr-MQ', 'fr-PF', 'fr-RE', 'ga-IE', 'he-IL', 'hu-HU', 'id-ID', 'it-IT', 'it-SM', 'ja-JP', 'ka-GE', 'kk-KZ', 'kl-GL', 'ko-KR', 'lt-LT', 'ms-MY', ''mz-MZ', nb-NO', 'ne-NP', 'nl-BE', 'nl-NL', 'nn-NO', 'pl-PL', 'pt-BR', 'pt-PT', 'pt-AO', 'ro-RO', 'ru-RU', 'si-LK' 'sl-SI', 'sk-SK', 'sq-AL', 'sr-RS', 'sv-SE', 'tg-TJ', 'th-TH', 'tk-TM', 'tr-TR', 'uk-UA', 'uz-UZ', 'vi-VN', 'zh-CN', 'zh-HK', 'zh-MO', 'zh-TW', 'dz-BT']` OR defaults to 'any'. If 'any' or a falsey value is used, function will check if any of the locales match).
`options` is an optional object that can be supplied with the following keys: `strictMode`, if this is set to `true`, the mobile phone number must be supplied with the country code and therefore must start with `+`. Locale list is `validator.isMobilePhoneLocales`.
**isMongoId(str)** | check if the string is a valid hex-encoded representation of a [MongoDB ObjectId][mongoid].
**isMultibyte(str)** | check if the string contains one or more multibyte chars.
**isNumeric(str [, options])** | check if the string contains only numbers.
`options` is an object which defaults to `{no_symbols: false}` it also has locale as an option. If `no_symbols` is true, the validator will reject numeric strings that feature a symbol (e.g. `+`, `-`, or `.`).
`locale` determine the decimal separator and 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', 'cs-CZ', 'da-DK', 'de-DE', 'en-AU', 'en-GB', 'en-HK', 'en-IN', 'en-NZ', 'en-US', 'en-ZA', 'en-ZM', 'es-ES', 'fr-FR', 'fr-CA', 'hu-HU', 'it-IT', 'nb-NO', 'nl-NL', 'nn-NO', 'pl-PL', 'pt-BR', 'pt-PT', 'ru-RU', 'sl-SI', 'sr-RS', 'sr-RS@latin', 'sv-SE', 'tr-TR', 'uk-UA']`.
diff --git a/src/lib/isMobilePhone.js b/src/lib/isMobilePhone.js
index 9f24bb916..c70310ef7 100644
--- a/src/lib/isMobilePhone.js
+++ b/src/lib/isMobilePhone.js
@@ -14,6 +14,7 @@ const phones = {
'ar-LY': /^((\+?218)|0)?(9[1-6]\d{7}|[1-8]\d{7,9})$/,
'ar-MA': /^(?:(?:\+|00)212|0)[5-7]\d{8}$/,
'ar-OM': /^((\+|00)968)?(9[1-9])\d{6}$/,
+ 'ar-PS': /^(\+?970|0)5[6|9](\d{7})$/,
'ar-SA': /^(!?(\+?966)|0)?5\d{8}$/,
'ar-SY': /^(!?(\+?963)|0)?9\d{8}$/,
'ar-TN': /^(\+?216)?[2459]\d{7}$/,
@@ -29,19 +30,23 @@ const phones = {
'de-AT': /^(\+43|0)\d{1,4}\d{3,12}$/,
'de-CH': /^(\+41|0)([1-9])\d{1,9}$/,
'de-LU': /^(\+352)?((6\d1)\d{6})$/,
+ 'dv-MV': /^(\+?960)?(7[2-9]|91|9[3-9])\d{7}$/,
'el-GR': /^(\+?30|0)?(69\d{8})$/,
'en-AU': /^(\+?61|0)4\d{8}$/,
'en-BM': /^(\+?1)?441(((3|7)\d{6}$)|(5[0-3][0-9]\d{4}$)|(59\d{5}))/,
'en-GB': /^(\+?44|0)7\d{9}$/,
'en-GG': /^(\+?44|0)1481\d{6}$/,
'en-GH': /^(\+233|0)(20|50|24|54|27|57|26|56|23|28|55|59)\d{7}$/,
+ 'en-GY': /^(\+592|0)6\d{6}$/,
'en-HK': /^(\+?852[-\s]?)?[456789]\d{3}[-\s]?\d{4}$/,
'en-MO': /^(\+?853[-\s]?)?[6]\d{3}[-\s]?\d{4}$/,
'en-IE': /^(\+?353|0)8[356789]\d{7}$/,
'en-IN': /^(\+?91|0)?[6789]\d{9}$/,
'en-KE': /^(\+?254|0)(7|1)\d{8}$/,
+ 'en-KI': /^((\+686|686)?)?( )?((6|7)(2|3|8)[0-9]{6})$/,
'en-MT': /^(\+?356|0)?(99|79|77|21|27|22|25)[0-9]{6}$/,
'en-MU': /^(\+?230|0)?\d{8}$/,
+ 'en-NA': /^(\+?264|0)(6|8)\d{7}$/,
'en-NG': /^(\+?234|0)?[789]\d{9}$/,
'en-NZ': /^(\+?64|0)[28]\d{7,9}$/,
'en-PK': /^((00|\+)?92|0)3[0-6]\d{8}$/,
@@ -55,6 +60,7 @@ const phones = {
'en-ZA': /^(\+?27|0)\d{9}$/,
'en-ZM': /^(\+?26)?09[567]\d{7}$/,
'en-ZW': /^(\+263)[0-9]{9}$/,
+ 'en-BW': /^(\+?267)?(7[1-8]{1})\d{6}$/,
'es-AR': /^\+?549(11|[2368]\d)\d{8}$/,
'es-BO': /^(\+?591)?(6|7)\d{7}$/,
'es-CO': /^(\+?57)?3(0(0|1|2|4|5)|1\d|2[0-4]|5(0|1))\d{7}$/,
@@ -69,6 +75,7 @@ const phones = {
'es-MX': /^(\+?52)?(1|01)?\d{10,11}$/,
'es-PA': /^(\+?507)\d{7,8}$/,
'es-PY': /^(\+?595|0)9[9876]\d{7}$/,
+ 'es-SV': /^(\+?503)?[67]\d{7}$/,
'es-UY': /^(\+598|0)9[1-9][\d]{6}$/,
'es-VE': /^(\+?58)?(2|4)\d{9}$/,
'et-EE': /^(\+?372)?\s?(5|8[1-4])\s?([0-9]\s?){6,7}$/,
@@ -76,11 +83,13 @@ const phones = {
'fi-FI': /^(\+?358|0)\s?(4(0|1|2|4|5|6)?|50)\s?(\d\s?){4,8}\d$/,
'fj-FJ': /^(\+?679)?\s?\d{3}\s?\d{4}$/,
'fo-FO': /^(\+?298)?\s?\d{2}\s?\d{2}\s?\d{2}$/,
+ 'fr-BF': /^(\+226|0)[67]\d{7}$/,
'fr-CM': /^(\+?237)6[0-9]{8}$/,
'fr-FR': /^(\+?33|0)[67]\d{8}$/,
'fr-GF': /^(\+?594|0|00594)[67]\d{8}$/,
'fr-GP': /^(\+?590|0|00590)[67]\d{8}$/,
'fr-MQ': /^(\+?596|0|00596)[67]\d{8}$/,
+ 'fr-PF': /^(\+?689)?8[789]\d{6}$/,
'fr-RE': /^(\+?262|0|00262)[67]\d{8}$/,
'he-IL': /^(\+972|0)([23489]|5[012345689]|77)[1-9]\d{6}$/,
'hu-HU': /^(\+?36|06)(20|30|31|50|70)\d{7}$/,
@@ -116,6 +125,7 @@ const phones = {
'tg-TJ': /^(\+?992)?[5][5]\d{7}$/,
'th-TH': /^(\+66|66|0)\d{9}$/,
'tr-TR': /^(\+?90|0)?5\d{9}$/,
+ 'tk-TM': /^(\+993|993|8)\d{8}$/,
'uk-UA': /^(\+?38|8)?0\d{9}$/,
'uz-UZ': /^(\+?998)?(6[125-79]|7[1-69]|88|9\d)\d{7}$/,
'vi-VN': /^((\+?84)|0)((3([2-9]))|(5([25689]))|(7([0|6-9]))|(8([1-9]))|(9([0-9])))([0-9]{7})$/,
diff --git a/test/validators.js b/test/validators.js
index 9faf73d56..a4e00293b 100644
--- a/test/validators.js
+++ b/test/validators.js
@@ -6027,6 +6027,26 @@ describe('Validators', () => {
'02122333',
],
},
+ {
+ locale: 'ar-PS',
+ valid: [
+ '+970563459876',
+ '970592334218',
+ '0566372345',
+ '0598273583',
+ ],
+ invalid: [
+ '+9759029487',
+ '97059123456789',
+ '598372348',
+ '97058aaaafjd',
+ '',
+ '05609123484',
+ '+97059',
+ '+970',
+ '97056',
+ ],
+ },
{
locale: 'ar-SY',
valid: [
@@ -6523,6 +6543,22 @@ describe('Validators', () => {
'+233292345671',
],
},
+ {
+ locale: 'en-GY',
+ valid: [
+ '+5926121234',
+ '06121234',
+ '06726381',
+ '+5926726381',
+ ],
+ invalid: [
+ '5926121234',
+ '6121234',
+ '+592 6121234',
+ '05926121234',
+ '+592-6121234',
+ ],
+ },
{
locale: 'en-HK',
valid: [
@@ -6608,6 +6644,22 @@ describe('Validators', () => {
'+254800723845',
],
},
+ {
+ locale: 'en-KI',
+ valid: [
+ '+68673140000',
+ '68673059999',
+ '+68663000000',
+ '68663019999',
+ ],
+ invalid: [
+ '+68653000000',
+ '68664019999',
+ '+68619019999',
+ '686123456789',
+ '+686733445',
+ ],
+ },
{
locale: 'en-MT',
valid: [
@@ -6733,6 +6785,31 @@ describe('Validators', () => {
'+3361245789',
],
},
+ {
+ locale: 'fr-BF',
+ valid: [
+ '+22661245789',
+ '+22665903092',
+ '+22672457898',
+ '+22673572346',
+ '061245789',
+ '071245783',
+ ],
+ invalid: [
+ '0612457892',
+ '06124578980',
+ '0112457898',
+ '0212457898',
+ '0312457898',
+ '0412457898',
+ '0512457898',
+ '0812457898',
+ '0912457898',
+ '+22762457898',
+ '+226724578980',
+ '+22634523',
+ ],
+ },
{
locale: 'fr-CA',
valid: ['19876543210', '8005552222', '+15673628910'],
@@ -6844,6 +6921,28 @@ describe('Validators', () => {
'+26261245789',
],
},
+ {
+ locale: 'fr-PF',
+ valid: [
+ '87123456',
+ '88123456',
+ '89123456',
+ '+68987123456',
+ '+68988123456',
+ '+68989123456',
+ '68987123456',
+ '68988123456',
+ '68989123456',
+ ],
+ invalid: [
+ '7123456',
+ '86123456',
+ '87 12 34 56',
+ 'definitely not a number',
+ '01+68988123456',
+ '6898912345',
+ ],
+ },
{
locale: 'ka-GE',
valid: [
@@ -7000,6 +7099,27 @@ describe('Validators', () => {
'66338855',
],
},
+ {
+ locale: ['en-NA'],
+ valid: [
+ '+26466189012',
+ '+26461555804',
+ '+26461434221',
+ '+26487555169',
+ '+26481555663',
+ ],
+ invalid: [
+ '12345',
+ '',
+ 'Vml2YW11cyBmZXJtZtesting123',
+ '+2641234567890',
+ '+2641234567',
+ '+2648143422',
+ '+264981234',
+ '4736338855',
+ '66338855',
+ ],
+ },
{
locale: 'ru-RU',
valid: [
@@ -7456,6 +7576,30 @@ describe('Validators', () => {
'+591993546843',
],
},
+ {
+ locale: 'es-SV',
+ valid: [
+ '62136634',
+ '50361366631',
+ '+50361366634',
+ '+50361367217',
+ '+50361367460',
+ '+50371367632',
+ '+50371367767',
+ '+50371368314',
+ ],
+ invalid: [
+ '+5032136663',
+ '21346663',
+ '+50321366663',
+ '12345',
+ 'El salvador',
+ 'this should fail',
+ '+5032222',
+ '+503 1111 1111',
+ '00 +503 1234 5678',
+ ],
+ },
{
locale: 'es-UY',
valid: [
@@ -8101,6 +8245,22 @@ describe('Validators', () => {
'081234567891',
],
},
+ {
+ locale: 'tk-TM',
+ valid: [
+ '+99312495154',
+ '99312130136',
+ '+99312918407',
+ '99312183399',
+ '812391717',
+ ],
+ invalid: [
+ '12345',
+ '+99412495154',
+ '99412495154',
+ '998900066506',
+ ],
+ },
{
locale: ['en-ZA', 'be-BY'],
valid: [
@@ -8145,6 +8305,31 @@ describe('Validators', () => {
'23274560591 ',
],
},
+ {
+ locale: 'en-BW',
+ valid: [
+ '+26772868545',
+ '+26776368790',
+ '+26774560512',
+ '26774560591',
+ '26778560512',
+ '74560512',
+ '76710284',
+ ],
+ invalid: [
+ '0799375902',
+ '12345',
+ '+2670745605448',
+ '2670745605482',
+ '+26779685451',
+ '+26770685451',
+ '267074560',
+ '2670ab5608',
+ '+267074560',
+ '70560512',
+ '79710284',
+ ],
+ },
{
locale: 'az-AZ',
valid: [
@@ -8297,6 +8482,23 @@ describe('Validators', () => {
'66338855',
],
},
+ {
+ locale: 'dv-MV',
+ valid: [
+ '+960973256874',
+ '781246378',
+ '+960766354789',
+ '+960912354789',
+ ],
+ invalid: [
+ '+96059234567',
+ '+96045789',
+ '7812463784',
+ '+960706985478',
+ '+960926985478',
+ 'NotANumber',
+ ],
+ },
];
let allValid = [];