--Specify Only the Lower Number of Matches--

Hi guys,

I have been stuck on this test for a few minutes (I’m sure it’s something simple I’m missing!) and it’s driving me crazy…what am I missing?!

Thanks in advance :slight_smile:

Matthew

Your code so far


let haStr = "Hazzzzah";
let haRegex = /Haz{4,}h/; // Change this line
let result = haRegex.test(haStr);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/regular-expressions/specify-only-the-lower-number-of-matches

You need to check your spelling of hazzah, specifically the a after the z’s.

Hope this helps :slight_smile:

You know when you are just having one of those days?

Thanks so much for your quick reply…very much appreciated! :slight_smile:

I am currently working on this challenge but cannot pass all tests…

Well in my mind “Hazzah” and “Hazah” are spelled differently, yet

/Haz{4,}ah/;

and not /Haz{4,}zah/;
shrugs

If you write /Haz{4,}zah/ it means at least 5 ‘z’ (the 4 from the z{4,} and then the one after that), it is different from /Haz{4,}ah/ where it is at least 4 ‘z’, one less because you don’t have the ‘z’ after the parenthesis

Though i have the doubt if /Haz{4,}zah/; will work because z{4,} match 4 or more ‘z’, and the following one could already be matched so there would be an ‘a’ after the 4 or more ‘z’ but the expression wants a ‘z’ after the 4+ z, so I am not sure this would match… regex is strange to me still

2 Likes

How can I not see that simple thing? :thinking: