I don't understand something about this task

Within the answer to this task they give the following:
let crowd = “P1P2P3P4P5P6CCCP7P8P9”

I can understand why the rest of the code (regex and other variables) are in here and yes, according to the answer my regex is right anyway, and I thought that the other variables were coded into the task beforehand, hence I didn’t put it in (lesson learnt) but won’t I don’t understand is this “P1P2P3P4P5P6CCCP7P8P9”, where does this come from. Nowhere within the question does it even mention the above or is this one of those FCC mistakes again?

Thanks for your help)

Your code so far


let reCriminals = /C+/ig; // 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/92.0.4515.159 Safari/537.36

Challenge: Find One or More Criminals in a Hunt

Link to the challenge:

Hi @1271xx ,

g modifier: global (matches all the given character)

i modifier: insensitive. Case insensitive match. 

Since you have to match C, remove i from the reCriminals variable.

the strings in the test text are used by the tests to check if your regex work

this is one of the strings used by the tests, you can see it in the test list

if you find any mistake please report it


EDIT: do you mean in the guide?
it seems it was never updated after the challenge was changed to simplify the code in the editor, I have now updated it

Its the actual answer, i got everything right except this part thats mentioned

I don’t understand, can you explain more?

You asked where i got that large string from (the one in question). So i said it is in the answer to this task, what i would like to know is where FCC got this string from and why they are using it. Hope this helps?

They just needed a string to use in the test. They made it up. Any string with some “C” and some “not C” would work. The string means nothing. It looks like some important code, but it’s not. I don’t know what “P1” is supposed to be and it doesn’t matter.

Kevin, if you look at the answer to this challenge you will see it there as a string, this is exactly what um asking, ive looked at the answer because my /C+/ answer doesn’t pass, so I looked at the answer to this question and so that long string is part of the answer, it showd up as the string that we’re “supposed to” use as part of the answer. Im now wondering why FCC gives such a string where it doesn’t actually mention that string within the question, hence my question??? Does this make sense?
Please go look at the answer and youll see what im talking about :wink:
You see, when i only use /C+/ as an answer it doesn’t pass so i went to the answer and they give this long string, where they get that from is what id like to know. The question makes no mention of it is, why im confused :wink:

Again… It’s just a string that was chosen for the tests. It has absolutely nothing to do with the answer.

It doesn’t pass because what you offered was wrong:

let reCriminals = /C+/ig; // Change this line

It’s not because there is a problem with the test string, but there is a problem with your solution.

@nivethakrishnan72 was trying to give you a big hint:

Since you have to match C , remove i from the reCriminals variable.

Adding the i tells it to match both “C” and “c”. You only want to match the former.

Ahhh, so it should then pass actually if i removed i, makes sense… :wink:
Yeah ill admit i didn’t see the above hint hey but it makes sense to remove i…

I’ve changed the guide, now it is updated. The guide is not official solution, it is maintained by volunteers, we try to keep it as up to date as possible but we may miss stuff. The solution is now up to date and doesn’t include the string anymore.

That string is not why your code is not passing, even in that situation the string was not part of what the tests test. The tests test only the regex.

Thank you)
It was just that string that was confusing me
Appreciate your work)

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