ok campers, ive done my best to do this on my own
ive done some reading and ive managed to figure out most of the challenge but I cant seem to figure the last few out.
its in a spoiler tag what I got so far.
// /\b\d{10}\b 5555555555
// /\d{3}-\d{3}-\d{4}/ 555-555-5555
// /\d{3} \d{3} \d{4}/ 555 555 5555
// /\(\d{3}\) \d{3} \d{4}/ (555) 555 5555
// /\(\d{3}\)\d{3} \d{4}/ (555)555 5555
// /\(\d{3}\)\d{3}-\d{4}/ (555)555-5555
//seperate regExp by |
function telephoneCheck(str) {
var format=/\b\d{10}\b|\b\d{3}-\d{3}-\d{4}|\d{3} \d{3} \d{4}\b|\b\(\d{3}\) \d{3} \d{4}\b|\b\(\d{3}\)\d{3} \d{4}\b|\b\(\d{3}\)\d{3}-\d{4}\b/;
return format.test(str);
}
telephoneCheck("(65055?52368)");
is there a way to count the spaces in between parentheses?
and why does “(65055?52368)” return true? that is not in any of the formats I added!?!?!
rant over…I feel as if its something I’m going to facepalm for missing.
P.S.
whoever invented regular expressions was a genius, a sadistic genius, but a genius