A group of criminals escaped from jail and ran away, but you don’t know how many. However, you do know that they stay close together when they are around other people. You are responsible for finding all of the criminals at once.
Are you surrounding your regexp in slashes?
let regexp = /t.[a-z]*t/;
Are you using the ‘+’ flag in your regexp?
let regexp = /E+/; // returns E, EE, EEE patterns
Solution 1 (Click to Show/Hide)
let crowd = "P1P2P3P4P5P6CCCP7P8P9"; let reCriminals = /C+/; // Change this line let matchedCriminals = crowd.match(reCriminals); console.log(matchedCriminals);