I was able to solve the supplied problem, but I felt like I cheated because I used the a caret and dollar sign at the beginning and end to specify I only wanted 3 or more matches of digits. I believe the solution FCC was looking for was different. Anybody else have different solutions?
I ran into an issue with my code not working if I didn’t implement the caret and dollar sign, but I know there must be a way to solve this without the caret and dollar sign.
Use capture groups in reRegex to match numbers that are repeated only three times in a string, each separated by a space.
Your regex should use the shorthand character class for digits.
Your regex should reuse the capture group twice.
Your regex should have two spaces separating the three numbers.
Your regex should match “42 42 42”.
Your regex should match “100 100 100”.
Your regex should not match “42 42 42 42”.
Your regex should not match “42 42”.
Your regex should not match “101 102 103”.
Your regex should not match “1 2 3”.
Your regex should match “10 10 10”.
let repeatNum = "42 42 42"; let reRegex = /^(\d+)\s\1\s\1$/; // Change this line let result = reRegex.test(repeatNum);
Link to problem: