I must suck at coding because I’m making a lot of these, soz…
anyway
let repeatNum = "42 42 42";
let reRegex = /(\d+) \1 \1/; // Change this line
let result = repeatNum.match(reRegex);
Why does this not work? Apparently it doesnt specify the amount of times I’m looking for the number to be repeated, but I thought it would because there are overall 3 references to \d+ (42), and so how could it be confused for four? There is /d at the start, and then 2 \1s after it, which overall makes three not four. I’m confused
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36 Edg/110.0.1587.63
Challenge: Regular Expressions - Reuse Patterns Using Capture Groups
Link to the challenge: