Telephone Validator help [SOLVED]

Link to challenge

I’m using to test my regex and I’m testing all the tests that should return true. However, for some reason it matches on the website, but when I run the tests on FCC, it doesn’t work. What’s wrong?

I know my code won’t pass every test, but I want to know why there’s a descrepancy between the site I’m using to check the regex and FCC’s tests.

function telephoneCheck(str) {
  // Check if valid pattern
  let pattern = /1?\s?(\(\d{3}\)|\d{3})[-\s]*\d{3}[-\s]*\d{4}/;
  if(str.match(pattern)){return true;}

  return false;


Can you please share the FCC link for this challenge?

Sorry. Edited first post.

Which specific test case are you finding a discrepancy between the FCC site and regexr site?

these four:

  • 1 555-555-5555
  • 1 (555) 555-5555
  • 1 555 555 5555
  • 1 456 789 4444

For the above, your code returns true and the regexr site shows a match for it, so why do you think there is a discrepancy?

Oh. I think it’s just my browser. I tried it on a different one and it worked. Thanks~