Telephone Number Validator Project

Hello,

I’m working on the Telephone Number Validator Project at the moment. I’m building regex to validate phone numbers. I’ve added a regex to filter for numbers that are a combination of 10 digits. I thought the regex would only filter numbers that are only 10 digits but it is filtering combination of numbers greater than 10 digits. Can someone help figure out what I’m doing wrong here?

This is the regex in question: regex1 = /[0-9]{10}/

Project link

Thanks in advance.

Maybe you can match on the start ^ and end $

You can use a site like https://regexr.com/ to test it. It also has Community Patterns you can look at (just search for the regex).

1 Like

That did the trick. Thank you!