Telephone Number Validator - Giving FCC Forums another chance

Terms and Conditions say content is ours, I’d like all my threads deleted like I’ve asked before. I give up trying to get help here.

Your str variable will never equal regEx, because one is a string and one is a regular expression.

If you want to test that str matches your regular expression, read about RegExp.prototype.test.

Are you talking about your existing code passing all but 7 or are you talking about using the RegExp.protottype.test method passes all but 7?

The code you posted above passes all but 7 of the tests, because all but 7 of the tests should return false. Your code returns false for every single test case because of the reason I told you in my first reply.

If you use regEx.test(str) correctly, you will pass all the tests.

So why does your posted code pass all but 7? Pure chance.

1 Like

Does this mean you want to delete this topic?

Well, I’ve asked that for the others and I’ve been ignored. Don’t get why the response now would be different. But sure. It doesn’t need to be here unless the 0 and 1 comments are seen as valid.

I will leave the post.