Find one or more criminals in hunt - greedy regex

Can someone help me out here, I think I need to use .match on a variable in order to complete the other tests, but I don’t understand how I would get the crowd data or what to write for this. Or whether I need to and the challenge is accepted just by writing a regex?

Your code so far


let reCriminals = /C+.*/g; // Change this line

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.164 Safari/537.36 Edg/91.0.864.71

Challenge: Find One or More Criminals in a Hunt

Link to the challenge:

Hi @n1a ,

The challenge is accepted by just writing the regex.
But if you want to see for yourself what the regex matches, you could do a console.log as below:

let reCriminals = //your regex here
let str = 'P6P2P7P4P5CCCCCP3P1'
console.log(str.match(reCriminals))

As you will be able to see from the console that your regex matches more than just
‘CCCCC’

Hope this helps

3 Likes

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