Quick question for Regular Expresssions : Specify Upper and Lower Number of Matches

Hello! Was wondering why would /Oh{3,6} n/ not work and /Oh{3,6} no/ work for the challenge when they have the same console results?

Your code so far


let ohStr = "Ohhhhhh no";
let ohRegex = /Oh{3,6} no/; // Change this line
let result = ohRegex.test(ohStr);

**Your browser information:**Specify Upper and Lower Number of Matches

Challenge: Specify Upper and Lower Number of Matches

Link to the challenge:

You’re supposed to match the “no” at the end. If you don’t do that then the challenge tests will fail.

The regexp test function returns true or false if a pattern appears in a string. /Oh{3,6} n/ is a pattern that appears in the string, so that function returns true, but it isn’t what you’re asked to do – /O/ will also return true. As will /Oh{3,6}/ or /h{3,6}/ or /n/, but they aren’t the right answers for that challenge.

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