Tell us what’s happening:
Hey, i have checked the other posts regarding capture groups in this challenge. I am yet to understand why my solution is wrong (or what is the reason for fixating the pattern at the start and at the end of the regex?)
Kindly help me understand, even an analogy would be appreciated.
Your code so far
let repeatNum = "42 42 42";
let reRegex = /(\d+)(\s)\1\2\1/; // Change this line
let resultT = reRegex.test(repeatNum);
let resultM = repeatNum.match(reRegex);
console.log(resultT);
console.log(resultM);
/*
reRegex:
the whole string returns group 0 i.e., \0
(\d+) : is group 1 i.e., \1
(\s) : is group 2 i.e., \2
*/
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/*Safari/537.36
Challenge: Reuse Patterns Using Capture Groups
Link to the challenge: