Regex challenge issue?

I think I’ve found a glitch with a checking program.
My code is:

let repeatNum = "42 42 42";
let reRegex = /^(\d+)\s\1\s\1$/g; // Change this line
let result = reRegex.test(repeatNum);
alert(result)

And the alert says true, but the condition,
Your regex should match "42 42 42"
has a big ‘X’

What challenge exactly? There are a lot…
But your RegEx matches any number with spaces. It matches “1 1 1” too.

1 Like

Weird, because on RegEx101 it matches “42 42 42”.

Remove the global flag from your RegEx and it should solve the challge. Im not sure why, but as I said on RegEx101 it matches “42 42 42”, even with the global flag.

Yeah, thanks, that works now!
I’m guessing it’s just a picky criterium. I’ve had similar issues before.
Yeah, that was the challenge I was attempting, sorry for not mentioning that.