Tell us what’s happening:
Tried the answer on a Regex editor, and the only way I was able to match 42, 3 times was : (\d+)\s\1\s\1. This excludes the answer provided.
My reading of the provides answer is:
let reRegex = /^(\d+)\s\1\s\1$/;
Match the start
^ with one digit of more
(\d+) followed by a white space
\s followed by another one digit or more
\1 followed by another white space
\s followed by another one digit or more in the end/finishing
Could someone clarify, if I’m getting crazy?
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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36.