Meaning of \1, \2,\s

Tell us what’s happening:
Describe your issue in detail here.
Hi,
Can Anyone explain to me the meaning and when I have to use \1, \2,\s?

Your code so far


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



Your browser information:

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

Challenge: Reuse Patterns Using Capture Groups

Link to the challenge:

\ is a special symbol in regex. Whenever you place it before a sign, you tell the program, “dont read this sign literally, it stands for something”. When we write d, the program reads the lower case letter “d”. When we write \d, the program takes it as a sign for all digits. \s stands for whitespace character, which can range from single space, or a new line, or a tab space. When we wrap a regular expression inside brackets, we call it a capture group, something we can refer to later, for example (\d+). \1 will refer to the first capture group in our expression. \d+ stands for one or more digits. /(\d+) \1 \1 / , here we will match the “one or more digits” string and also look if that same string repeats twice more, like with the case with “42 42 42”.