Working with Regular Expressions - What Are Capturing Groups and Backreferences, and How Do They Work?

Tell us what’s happening:

const regex = /free(co+de)camp.*free(co+de)camp/i;
console.log(regex.test(“freecooooodecamp is great i love freecooooodecamp”)); // true
console.log(regex.test(“freecooooodecamp is great i love freecodecamp”)); // false

I discovered an error in the transcript; the second console log output a true result. Furthermore, the lecture video (3:18) has a different code snippet compared to the transcript.

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36

Challenge Information:

Working with Regular Expressions - What Are Capturing Groups and Backreferences, and How Do They Work?
https://www.freecodecamp.org/learn/full-stack-developer/lecture-working-with-regular-expressions/what-are-capturing-groups-and-backreferences-and-how-do-they-work

It would be great if you can report this to help make FCC better. Bugs can be reported as GitHub Issues. Whenever reporting a bug, please check first that there isn’t already an issue for it and provide as much detail as possible.

I have created an issue for it here

The video has the correct code but the transcript, as you pointed out, does not.

Thanks for catching this :+1:

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