Tell us what’s happening:
With the code I used here it only captures “2” in the first group instead of “42” and it captures the “42” if I omit the “\1” at the end.
But in the example given in the lesson the pattern I used does capture the entire word. Why is that?
Also, What wrong am I doing with the code?
Your code so far
let repeatNum = "42 42 42"; let reRegex = /(\d+)\s(\d+)\s(\d+)\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/67.0.3396.99 Safari/537.36.