# Please explain the logic behind the Capture Group Challenge

Tell us what’s happening:

I would like someone to walk me through the answer, please. This is how I thought my current answer would work:

1. ^(\d+)\s- At the beginning of the string, find any digit followed by a space.
2. \1 - Repeat that pattern, which is (\d+)\s . So currently I would have ['42 42 '].
3. \d+\$ - At the end of the string, find any digit. So I’d assume I would have ['42 42 42']. I’d have three digits because there were three \d+'s.
4. I didn’t call on the pattern again.

I’m wrong. The solution is /^(\d+)\s\1\s\1\$/;. I understand it up until the next ...\s\1\$/; I understand that /^(\d+)\s\1 would give me ['42 42 '] because the pattern is called two times, once explicitly and another using \1, which is what I put. So I’m thinking we’d be up the string at the third digit. But why is there another space followed by the same pattern? Wouldn’t the regex try to find ['(42 space) (42 space) space (42 space)']?

let repeatNum = "42 42 42";
let reRegex = /^(\d+)\s\1\d+\$/; // Change this line
let result = reRegex.test(repeatNum);