Freecodecamp: [beta] Regular Expressions: Specify Upper and Lower Number of Matches

Created on 15 May 2017  路  4Comments  路  Source: freeCodeCamp/freeCodeCamp

Regular Expressions: Specify Upper and Lower Number of Matches
http://beta.freecodecamp.com/en/challenges/regular-expressions/specify-upper-and-lower-number-of-matches

The challenge has difficulties passing some of the tests, refreshing the tab forced the test
-Your regex should not match "Ohh no"
to pass

but
-Your regex should not match "Ohhhhhhh no"
still does not pass

screenshot 2017-05-15 at 9 22 38 am

Most helpful comment

The Challenge is fine. Check your solution; You did not account for the no after oh, so the regex matches up ohhh(n-infinity) because you don't have a stopper.

All 4 comments

The Challenge is fine. Check your solution; You did not account for the no after oh, so the regex matches up ohhh(n-infinity) because you don't have a stopper.

thanks for this, I didnt think to include the latter part of the string

I have been struggling with the last 2 regex challenges for the better part of an hour now

Regular Expressions: Reuse Patterns Using Capture Groups
Regular Expressions: Remove Whitespace from Start and End

Is this resolved, if not please revert back, to re-open?

Here's the code I used to pass this challenge:
let ohStr = "Ohhh no";
let ohRegex = /Oh{3,6}\sno/; // change this line
let result = ohRegex.test(ohStr);

Was this page helpful?
0 / 5 - 0 ratings