JavaScript Algorithms and Data Structures Projects - Telephone Number Validator

Hi,

I would suggest the resource https://extendsclass.com/regex-tester.html
It is nice to test regular expressions

I’m still not sure how I could fix the code so the last three would return false. I am genuinely stuck.

I was kind of thinking about this and I think you could find this resource useful

It is an interactive regex tutorial.
If you make your way through all the exercises, I believe it will give you some useful information about how to make a better regex that can distinguish between the different types of telephone numbers.

There is more than one way to tackle this but I think this way is the simplest and may help you faster.

Still not sure how I could fix the code to make it pass.

I know you guys won’t give me any hints for this project. But I am still genuinely stuck on this.

Did you ever figure out a solution? My regex looks almost identical, and I’m stuck trying to pass the same 3 stories. I tried to use those tools suggested too and, in the context of this particular issue, they aren’t much help. My code is passing the test as ‘true’ when it should be ‘false’.

telephoneCheck("1 555)555-5555") should return false .
telephoneCheck("555)-555-5555") should return false.
telephoneCheck("(555-555-5555") should return false.

Edit: Never mind. Figured it out. The original replies from @Sanity helped.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.