From 13e0edb568a52985562d6593dd858078383614c0 Mon Sep 17 00:00:00 2001 From: Tom Klinovsky Date: Wed, 14 Dec 2016 13:16:33 +0200 Subject: [PATCH 1/3] added regex for israeli phone numbers --- src/lib/isMobilePhone.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib/isMobilePhone.js b/src/lib/isMobilePhone.js index 25b967a72..f2b68a824 100644 --- a/src/lib/isMobilePhone.js +++ b/src/lib/isMobilePhone.js @@ -20,6 +20,7 @@ const phones = { 'es-ES': /^(\+?34)?(6\d{1}|7[1234])\d{7}$/, 'fi-FI': /^(\+?358|0)\s?(4(0|1|2|4|5)?|50)\s?(\d\s?){4,8}\d$/, 'fr-FR': /^(\+?33|0)[67]\d{8}$/, + 'he-IL': /^(\+972|0)([23489]|5[0248]|77)[1-9]\d{6}/, 'hu-HU': /^(\+?36)(20|30|70)\d{7}$/, 'it-IT': /^(\+?39)?\s?3\d{2} ?\d{6,7}$/, 'ja-JP': /^(\+?81|0)\d{1,4}[ \-]?\d{1,4}[ \-]?\d{4}$/, From f35fa49a4907a3e722234cee36d6ef3978e2b7e3 Mon Sep 17 00:00:00 2001 From: tomklino Date: Wed, 14 Dec 2016 13:22:17 +0200 Subject: [PATCH 2/3] removed trailing spaces --- src/lib/isMobilePhone.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/isMobilePhone.js b/src/lib/isMobilePhone.js index f2b68a824..a2f176d66 100644 --- a/src/lib/isMobilePhone.js +++ b/src/lib/isMobilePhone.js @@ -20,7 +20,7 @@ const phones = { 'es-ES': /^(\+?34)?(6\d{1}|7[1234])\d{7}$/, 'fi-FI': /^(\+?358|0)\s?(4(0|1|2|4|5)?|50)\s?(\d\s?){4,8}\d$/, 'fr-FR': /^(\+?33|0)[67]\d{8}$/, - 'he-IL': /^(\+972|0)([23489]|5[0248]|77)[1-9]\d{6}/, + 'he-IL': /^(\+972|0)([23489]|5[0248]|77)[1-9]\d{6}/, 'hu-HU': /^(\+?36)(20|30|70)\d{7}$/, 'it-IT': /^(\+?39)?\s?3\d{2} ?\d{6,7}$/, 'ja-JP': /^(\+?81|0)\d{1,4}[ \-]?\d{1,4}[ \-]?\d{4}$/, From 426d791a328aca30fd65b4b415cffcc0af3a6ff6 Mon Sep 17 00:00:00 2001 From: Tom Klinovsky Date: Sun, 18 Dec 2016 12:50:26 +0200 Subject: [PATCH 3/3] updated README to include he-IL phone detection --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 38d2dd336..2b7a81d7d 100644 --- a/README.md +++ b/README.md @@ -88,7 +88,7 @@ Passing anything other than a string is an error. - **isLowercase(str)** - check if the string is lowercase. - **isMACAddress(str)** - check if the string is a MAC address. - **isMD5(str)** - check if the string is a MD5 hash. -- **isMobilePhone(str, locale)** - check if the string is a mobile phone number, (locale is one of `['ar-DZ', 'ar-SA', 'ar-SY', 'cs-CZ', 'de-DE', 'da-DK', 'el-GR', 'en-AU', 'en-GB', 'en-HK', 'en-IN', 'en-NZ', 'en-US', 'en-CA', 'en-ZA', 'en-ZM', 'es-ES', 'fi-FI', 'fr-FR', 'hu-HU', 'it-IT', 'ja-JP', 'ms-MY', 'nb-NO', 'nn-NO', 'pl-PL', 'pt-PT', 'ru-RU', 'sr-RS', 'tr-TR', 'vi-VN', 'zh-CN', 'zh-TW']`). +- **isMobilePhone(str, locale)** - check if the string is a mobile phone number, (locale is one of `['ar-DZ', 'ar-SA', 'ar-SY', 'cs-CZ', 'de-DE', 'da-DK', 'el-GR', 'en-AU', 'en-GB', 'en-HK', 'en-IN', 'en-NZ', 'en-US', 'en-CA', 'en-ZA', 'en-ZM', 'es-ES', 'fi-FI', 'fr-FR', 'he-IL', 'hu-HU', 'it-IT', 'ja-JP', 'ms-MY', 'nb-NO', 'nn-NO', 'pl-PL', 'pt-PT', 'ru-RU', 'sr-RS', 'tr-TR', 'vi-VN', 'zh-CN', 'zh-TW']`). - **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)** - check if the string contains only numbers.