# Problem with the Hint 2 (Positive and Negative Lookahead)

**URL:** <https://forum.freecodecamp.org/t/problem-with-the-hint-2-positive-and-negative-lookahead/449862>\
**Category:** freeCodeCamp Contributors\
**Tags:** contributing\
**Created:** [March 6, 2021, 1:58pm UTC](https://forum.freecodecamp.org/t/problem-with-the-hint-2-positive-and-negative-lookahead/449862 "2021-03-06T13:58:33Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![MarcosSouza](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/marcossouza/32/220070_2.png) [@MarcosSouza](https://forum.freecodecamp.org/u/MarcosSouza)\
**Post date:** [March 6, 2021, 1:58pm UTC](https://forum.freecodecamp.org/t/problem-with-the-hint-2-positive-and-negative-lookahead/449862/1 "2021-03-06T13:58:33Z")

</div>

Hello!

The problem is related to the Hint 2 ([freeCodeCamp Challenge Guide: Positive and Negative Lookahead](https://forum.freecodecamp.org/t/freecodecamp-challenge-guide-positive-and-negative-lookahead/301360)) of the challenge " Positive and Negative Lookahead" ([https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/regular-expressions/positive-and-negative-lookahead](https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/regular-expressions/positive-and-negative-lookahead))

The Hint 2 finishes with “Remember to specify the exact amount of numbers you want to appear at the end of the string.”

But the checklist in the challenge says that “Your regex should match the string astr1on11aut”.

I’m novice, so I might be wrong, but I think that it should be like “Remember to specify the exact amount of numbers you want to appear consecutively on the string.”

Anyway, if I’m wrong, I’m sorry and, if it’s possible, explain me why it is right.

Kind regards!  
Marcos.

---

<div class="post-metadata">

**Author:** ![evidence357](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/evidence357/32/134214_2.png) [@evidence357](https://forum.freecodecamp.org/u/evidence357)\
**Post date:** [March 29, 2021, 4:04pm UTC](https://forum.freecodecamp.org/t/problem-with-the-hint-2-positive-and-negative-lookahead/449862/2 "2021-03-29T16:04:00Z")

</div>

Hi Marcos,

Remember this paragraph from the first lesson or challenge in the Regular Expressions course ([https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/regular-expressions/using-the-test-method](https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/regular-expressions/using-the-test-method))?

I quote it below:

" _If you want to find the word `the` in the string `The dog chased the cat` , you could use the following regular expression: `/the/` . **Notice that quote marks are not required within the regular expression**._ "

With that understanding, I think the statement you referenced from Hint 2 is talking about the string that you put in **myRegex**.

So this is what I think it meant to communicate : Remember to specify the exact amount of numbers you want to appear at the end of the _ **regex** _ string.

I think thus that your concern is legitimate.

Best regards.

---

<div class="post-metadata">

**Author:** ![MarcosSouza](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/marcossouza/32/220070_2.png) [@MarcosSouza](https://forum.freecodecamp.org/u/MarcosSouza)\
**Post date:** [March 29, 2021, 5:34pm UTC](https://forum.freecodecamp.org/t/problem-with-the-hint-2-positive-and-negative-lookahead/449862/3 "2021-03-29T17:34:40Z")

</div>

Thanks!  
That makes more sense now!  
Thank you so much!! =D

---

<div class="post-metadata">

**Author:** ![evidence357](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/evidence357/32/134214_2.png) [@evidence357](https://forum.freecodecamp.org/u/evidence357)\
**Post date:** [March 29, 2021, 5:36pm UTC](https://forum.freecodecamp.org/t/problem-with-the-hint-2-positive-and-negative-lookahead/449862/4 "2021-03-29T17:36:10Z")

</div>

Welcome Marcos. I’m glad.

---

<div class="post-metadata">

**Author:** ![good.answer.e](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/good.answer.e/32/185281_2.png) [@good.answer.e](https://forum.freecodecamp.org/u/good.answer.e)\
**Post date:** [May 22, 2021, 9:06pm UTC](https://forum.freecodecamp.org/t/problem-with-the-hint-2-positive-and-negative-lookahead/449862/5 "2021-05-22T21:06:52Z")

</div>

`(?=\w*\d{2,})` hello 👋  
dont understand why do we need \w at first wright  
and why this combination works, but not togeather

```auto
//(?=\d{2})/ // filter for at list 2 numbers

//(?=\w{6})/ // filter for more then 6 symbols

```

---

<div class="post-metadata">

**Author:** ![tryingtolearn](https://avatars.discourse-cdn.com/v4/letter/t/9de0a6/32.png) [@tryingtolearn](https://forum.freecodecamp.org/u/tryingtolearn)\
**Post date:** [July 13, 2021, 9:44am UTC](https://forum.freecodecamp.org/t/problem-with-the-hint-2-positive-and-negative-lookahead/449862/6 "2021-07-13T09:44:36Z")

</div>

I am novice too and maybe could be wrong but as far as I understand when it specifes that you have to find exact matches, like in this case, 2 consecutive digits, it means that you have exclude everything else and just look for two consecutive digits. Correct me someone if I’m wrong, please.

---

<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:** [July 13, 2021, 10:44am UTC](https://forum.freecodecamp.org/t/problem-with-the-hint-2-positive-and-negative-lookahead/449862/7 "2021-07-13T10:44:31Z")

</div>

> [@good.answer.e](#):
>
> dont understand why do we need \w at first wright

the two lookaheads look from same position, if you don’t write `\w*` then the second lookahead is imposing that the numbers have to be at the start of the 6 characters matched by the other lookahead

---

<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:** [January 11, 2022, 10:44pm UTC](https://forum.freecodecamp.org/t/problem-with-the-hint-2-positive-and-negative-lookahead/449862/8 "2022-01-11T22:44:49Z")

</div>

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