fix(guide): correct regex for intermediate solution code (#35784)
This commit is contained in:
@@ -93,7 +93,7 @@ Start by trying to get it to validate each format from the example, each one sho
|
|||||||
##  Intermediate Code Solution:
|
##  Intermediate Code Solution:
|
||||||
|
|
||||||
function telephoneCheck(str) {
|
function telephoneCheck(str) {
|
||||||
var re = /^(?:(?:\+?1\s*(?:[.-]\s*)?)?(?:\(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*(?:[.-]\s*)?)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\s*(?:[.-]\s*)?([0-9]{4})$/;
|
var re = /^([+]?1[\s]?)?((?:[(](?:[2-9]1[02-9]|[2-9][02-8][0-9])[)][\s]?)|(?:(?:[2-9]1[02-9]|[2-9][02-8][0-9])[\s.-]?)){1}([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2}[\s.-]?){1}([0-9]{4}){1}$/;
|
||||||
return re.test(str);
|
return re.test(str);
|
||||||
}
|
}
|
||||||
telephoneCheck("555-555-5555");
|
telephoneCheck("555-555-5555");
|
||||||
|
Reference in New Issue
Block a user