Reuse Patterns Using Capture Groups Solution

Tell us what’s happening:
Can anyone tell me why this isn’t the correct answer? It works fine on Regexr.

Your code so far


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

Your browser information:

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

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

Your pattern fails on the requirement that the number be repeated only 3 times.

Go here to interact with the above tests.

1 Like