Question about --> Regular Expressions: Positive and Negative Lookahead

Regular Expressions: Positive and Negative Lookahead

assignment: https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/regular-expressions/positive-and-negative-lookahead

5 characters long and have two consecutive digits. 78777 meets these two requirements.

/(?=\w{3,})(?=\D\d{2,})/ - This solution is a valid solution to this assignment.

So result should equal true. But that is not the case. It indicates here that it is false.

What is happening?

I think this is the right solution --> /(?=\w{3,})(?=\D*\d{2,})/

Kind regards, Fabian

Love this community :slight_smile:

It’s asking you for something that is at least 5 characters long, yours is checking for something that is at least 3 characters long.

Perfect i understand. Thank you.

1 Like

Technically, the instructions state usernames should be greater than 5 characters not at least 5 characters.

2 Likes

Also true. How easy it is to make mistakes…

Oops, reading fail on my part as well, sorry!