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);
console.log(result[0]);
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: