Regex: Find One or More Criminals in a Hunt

Tell us what’s happening:
So I am using a separate ide for js to work through the problems and the only way I was able to solve this particular problem with my ide was to manually assign a string value to some variable s before matching it with my regex and finally taking the first index of the result. For example:

let text = “P1P5P4CCCP2P6P3”;

let myRegex = /C+/;

let result = text.match(myRegex);


However on FCC, it wants me to solve it in just 1 line of code which I think is impossible…

Your code so far
let myRegex = /C+/;

let reCriminals = /./; // 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/86.0.4240.111 Safari/537.36.

Challenge: Find One or More Criminals in a Hunt

Link to the challenge:


I assume you didn’t try that code in the challenge, right? The tests are already setup for you, so the challenge asks you for only the regex. If you put that in the FCC editor, you should pass the tests :slight_smile:.

Hey @hangingcello!

Please do not create duplicate posts. I removed the other post so people can only respond to this one. Thank you!

1 Like