I need help with Regular Expressions: Find One or More Criminals in a Hunt

Tell us what’s happening:

It may have seemed like i did nothing but i did and restetted my code because it didnt work

Your code so far


let reCriminals = /./; // Change this line

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:77.0) Gecko/20100101 Firefox/77.0.

Challenge: Find One or More Criminals in a Hunt

Link to the challenge:

Hello~!

Unfortunately, by resetting your code we are now unable to see what you have tried. Can you share what regex you were trying? Maybe we can point you in the right direction. :slight_smile:

ok i will send you the code

this is really all i could do because i couldnt really get it
let reCriminals = /C/; // Change this line

Hey, that’s a good start~ let’s see what happens when we run it.

So it is correctly matching one criminal. But it needs to be able to find and match all criminals in the string.

Do you remember how to tell a RegEx to match all instances? There is a certain flag you can set… :slight_smile:

i forget please help me im not the greatest coder

Do you remember this lesson: https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/regular-expressions/find-more-than-the-first-match

look at the description:

The regex /z+/ matches the letter z when it appears one or more times in a row. It would find matches in all of the following strings:

can you do the same with the letter C?

2 Likes