# Telephone Number Validator - Regex Problem (small bug)

**URL:** <https://forum.freecodecamp.org/t/telephone-number-validator-regex-problem-small-bug/378998>\
**Category:** General\
**Created:** [April 26, 2020, 1:30am UTC](https://forum.freecodecamp.org/t/telephone-number-validator-regex-problem-small-bug/378998 "2020-04-26T01:30:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kamaljyotwal](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/kamaljyotwal/32/167367_2.png) [@kamaljyotwal](https://forum.freecodecamp.org/u/kamaljyotwal)\
**Post date:** [April 26, 2020, 1:30am UTC](https://forum.freecodecamp.org/t/telephone-number-validator-regex-problem-small-bug/378998/1 "2020-04-26T01:30:19Z")

</div>

In the telephone number validator problem. i have passed all the test except these two where:

```auto
function telephoneCheck(str) {
 
 var regex= /^[1]*[|\(]*\d{3}[-]*[\)]*[]*\d{3}[|-]*\d{4}$/g
return regex.test(str)
}

console.log(telephoneCheck("1 555)555-5555"));

```

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

```

In both cases , i cannot make logic of in all three section if one section has opening bracket it should also have closing bracket  
If lookaheads should be used they how to manage the \d{3} which comes in between.  
Please Help  
link:[https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/telephone-number-validator](https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/telephone-number-validator)

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [June 1, 2021, 6:57pm UTC](https://forum.freecodecamp.org/t/telephone-number-validator-regex-problem-small-bug/378998/2 "2021-06-01T18:57:52Z")

</div>

Closed on June 1, 2021, 6:57pm UTC


