I have tried various combinations of RegEx to get this. For the most part it works except I can’t seem to figure out how to restrict the Country Code to 1 only. I am now attempting to go through the various number tests a little at a time. For just the first Item I have tried:
/^([1\s(])?/
/^([^2-9][\s(])?
Can you help please?
**Your code so far**
function telephoneCheck(str) {
var regEx = /^([1\s\(])?[\d{3}]/
return regEx.test(str);
}
telephoneCheck("555-555-5555");
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.51 Safari/537.36 Edg/99.0.1150.39
Challenge: Telephone Number Validator
Link to the challenge: