Tell us what’s happening:
I was stuck in this challenge for a while because of the way the challenge was explained. I feel that by mentioning “\1” maps to “regex” in the example given, it would make more sense.
Your code so far
let repeatStr = "regex regex";
let repeatRegex = /(\w+)\s\1/; // "\1" -> "regex"
repeatRegex.test(repeatStr); // Returns true
repeatStr.match(repeatRegex); // Returns ["regex regex", "regex"]
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/regular-expressions/reuse-patterns-using-capture-groups