Tell us what’s happening:
Hallo, could anyone help me to explain the RegExp rules here, I could not understand the entire contents.
I know $ stands for the end, \s for the space. This totally confuses me.
Thank you in advance!
Your code so far
let repeatNum = "42 42 42";
let reRegex = /^(\d+)\s\1\s\1$/; // Change this line
let result = reRegex.test(repeatNum);
console.log(result);
let testString = "test test test test test test";
let reRegex2 =/(test)(\s)\1\2\1/g;
let result2 = reRegex2.test(testString);
console.log(result2);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/regular-expressions/reuse-patterns-using-capture-groups