hi there just wondering why
let reRegex = /^(\d+) \1 \1$/;
passes
and ```
let reRegex = /(\d+) \1 \1/;
does not
confused as to how the second version maps 42 42 42 42 as this is the only test it doesnt pass
hi there just wondering why
let reRegex = /^(\d+) \1 \1$/;
passes
and ```
let reRegex = /(\d+) \1 \1/;
does not
confused as to how the second version maps 42 42 42 42 as this is the only test it doesnt pass
I don’t know if you’ve covered string anchors yet?
Your regex would match the string ‘42 42 42’, but it would also match ‘42 42 42 42’.
The challenge instructions:
Use capture groups in
reRegex
to match a string that consists of only the same number repeated exactly three times separated by single spaces.
You can use anchors to mark the beginning and end of the whole string.
For instance, /^cat$/
would match only the exact string ‘cat’ and not ‘The cat sat on the hat’.