Reuse Patterns Using Capture Groups [using 2 capture groups]

Tell us what’s happening:
I was wondering: if we allow using 2 capture groups (Its not the case but lets suppose it), then the following solution would be valid?

Your code so far


let repeatNum = "42 42 42";
let reRegex = /^(\d+)(\s)\1\2\1$/
let result = repeatNum.match(reRegex)
console.log(result)

let reRegex = /^(\d+)(\s)\1\2\1$/

let result = repeatNum.match(reRegex)

console.log(result)

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36 OPR/62.0.3331.119.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/regular-expressions/reuse-patterns-using-capture-groups/

regex101 is great tool for testing regular expressions.

Here is your pattern from above with the match tests from the challenge.