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+)\s\1\s\1$/;

let result = reRegex.test(repeatNum);
Your regex should not match the string 42\t42\t42 .

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

Your browser information:

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

Challenge: Regular Expressions - Reuse Patterns Using Capture Groups

Link to the challenge:

\t is a whitespace character and \s will match on it. You have to match on a literal space instead.

I guess you can also do a “not \t” match as well but that seems a little convoluted.

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