Tell us what’s happening:
Describe your issue in detail here.
Your code so far
hello, this is my regex but does not work…
let reRegex = /(\d)(\s)\1\2\1/g; // Change this line
**************************** Here’s a breakdown of what each part of the regular expression means:
(\d) - Matches and captures a single digit. The parentheses indicate a capturing group.
(\s) - Matches and captures a single whitespace character.
\1 - Matches the same digit as the one captured in the first capturing group.
\2 - Matches the same whitespace character as the one captured in the second capturing group.
\1 - Matches the same digit as the one captured in the first capturing group.
/g - This flag specifies a global search, so the regular expression will match all occurrences in the input string, not just the first one.
******** please help
let repeatNum = "42 42 42";
let reRegex = /(\d)(\s)\1\2\1/g; // Change this line
let result = reRegex.test(repeatNum);
console.log(result);
/*
/(test)(\s)\1\2\1/
let repeatStr = "row row row your boat"
let repeatRegex = /(\w+) \1 \1/;
let result = repeatRegex.test(repeatStr); // Returns true
let result_b = repeatStr.match(repeatRegex); // Returns ["row row row", "row"]
console.log(result);
console.log(result_b );
*/
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0
Challenge: Regular Expressions - Reuse Patterns Using Capture Groups
Link to the challenge: