Reuse Patterns Using Capture Groups
Summary
- Parentheses are used to find repeat substrings.
- To specify where that repeat string will appear, use a backslash and then a number.
Final Code
let repeatNum = "42 42 42";
let reRegex = /^(\d+)\s\1\s\1$/; // Change this line
let result = reRegex.test(repeatNum);