So this was my solution that worked. However when I through the solution here it was different. Am I on the right track? is my code workable?
my code so far
let reCriminals = /C+.*?/g; // Change this line
Your browser information:
User Agent is:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.2 Safari/605.1.15.
Challenge: Find One or More Criminals in a Hunt
Link to the challenge:
what’s this part for? can you explain your reasoning?
it ignores the other characters (in this case “not criminals”)
That is not what it does. It lazy matches zero or more of any character. This extra regex you added is not needed at all.
i thought differently.
so what does
.*? means to match the fewest number of characters possible for the rest of the expression to match. Since there is no rest of the expression, it will match against zero characters, which makes it redundant.
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.