Regular Expressions - Reuse Patterns Using Capture Groups

Tell us what’s happening:
Describe your issue in detail here.

Your code so far

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

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36

Challenge: Regular Expressions - Reuse Patterns Using Capture Groups

Link to the challenge:

“…match a string that consists of only the same number repeated exactly three times…”

You have the right idea, but you need to restrict it to exactly three times and no more. So you’ll need to add something else to the regular expression to do that. Can you think of anything you have already learned that would do this?

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.