# Telephone Number Validator Project

**URL:** <https://forum.freecodecamp.org/t/telephone-number-validator-project/692363>\
**Category:** Curriculum Help\
**Tags:** javascript\
**Created:** [May 27, 2024, 11:19pm UTC](https://forum.freecodecamp.org/t/telephone-number-validator-project/692363 "2024-05-27T23:19:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Af1991](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/af1991/32/362047_2.png) [@Af1991](https://forum.freecodecamp.org/u/Af1991)\
**Post date:** [May 27, 2024, 11:19pm UTC](https://forum.freecodecamp.org/t/telephone-number-validator-project/692363/1 "2024-05-27T23:19:50Z")

</div>

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](https://github.com/Afer1991/telephone-number-validator)

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![lasjorg](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/lasjorg/32/280761_2.png) [@lasjorg](https://forum.freecodecamp.org/u/lasjorg)\
**Post date:** [May 28, 2024, 12:50am UTC](https://forum.freecodecamp.org/t/telephone-number-validator-project/692363/2 "2024-05-28T00:50:57Z")

</div>

Maybe you can match on the start `^` and end `$`

> **[Assertions - JavaScript | MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions/Assertions)**
>
> Assertions include boundaries, which indicate the beginnings and endings of lines and words, and other patterns indicating in some way that a match is possible (including look-ahead, look-behind, and conditional expressions).

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

---

<div class="post-metadata">

**Author:** ![Af1991](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/af1991/32/362047_2.png) [@Af1991](https://forum.freecodecamp.org/u/Af1991)\
**Post date:** [May 28, 2024, 1:17am UTC](https://forum.freecodecamp.org/t/telephone-number-validator-project/692363/3 "2024-05-28T01:17:44Z")

</div>

That did the trick. Thank you!

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/freecodecamp/original/3X/e/1/e1c433102e34b46dfaa3e15d13ab9a514b127078.svg) [@system](https://forum.freecodecamp.org/u/system)\
**Post date:** [November 26, 2024, 1:18pm UTC](https://forum.freecodecamp.org/t/telephone-number-validator-project/692363/4 "2024-11-26T13:18:02Z")

</div>

Closed on November 26, 2024, 1:18pm UTC

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