In the example related to the Regular Expressions: Reuse patterns using capture groups, I was wondering how to print the results of the example so I can see how it worked on Repl or sublime text.
let repeatStr = "regex regex";
let repeatRegex = /(\w+)\s\1/;
let result = repeatRegex.test(repeatStr); // Returns true
let result2 = repeatStr.match(repeatRegex.test(repeatStr)); // Returns ["regex regex", "regex"]
//this value returns false;
console.log(result);
//why does this code return null? How can I fix it?
console.log(result2);
Can anyone please point me in the right direction?