Question about Reuse Patterns Using Capture Groups

Tell us what’s happening:
Hi my initial answer for this challenge is /^(\d+)(\s)\1\2\1$/ which didn’t fit two of the requirements:

  • Your regex should reuse the capture group twice.
  • Your regex should have two spaces separating the three numbers.

Which I think you can say I didn’t use “two” spaces but “capture group of space”, but I am pretty sure I did reuse capture group twice.

Using the testing method, myAnswer and fccAnswer both return true, so theoretically myAnswer should be accept as well?

Is there something I didn’t notice or Is it a wording problem after all? (Since I use “capture group of space” instead of “space” and reuse capture group “at least twice” instead of twice.)

I tested some possibilities using the browser console:

let number = "42 42 42"
let myAnswer = /^(\d+)(\s)\1\2\1$/;
let fccAnswer = /^(\d+)\s\1\s\1$/;

// Testing


fccAnswer.test("42 42 42");//false
myAnswer.test("42 42 42");//false

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36.

Link to the challenge:

The tests checking what you wrote are not expecting you to use the capture group for the space too - just add in a normal space or \s and it will pass

@mingyco You have discovered a bug in the tests. I have created a pull request which would allow your solution (which meets all the challenge requirements).

Got it, Thanks a lot.