RegEx Challenge

Could use a little help with this challenge from the freecodecamp beta - I’ve checked and I don’t think it’s a bug - I’m just not getting something.
Here’s the challenge:

I was pretty hopeful with:
let reRegex = /(\d+\s*)\1/;

But no joy. That passes all the tests except the second:

Your regex should reuse the capture group twice.

I suspect because the space it matched does not repeat after the third number, but not sure.

Thanks for any help.

(And yep, I do know how to spend a Friday night!)

Probably this. Also you only used it once (there’s only one \1)

1 Like

Ah! Thanks so much - I misinterpreted what the \1 meant (and somehow thought \s* would cover the last number with no space after it… but at that point of course the space is part of the capture group). Love it when it all clicks. Thanks for taking the time to explain.

1 Like

Can see how that would be handy. Couldn’t work out the /1 from the challenge so checked other sources, and thought I understood it - but nope. Nothing was as clear as your explanations - thanks again!