hello camper, captrue group is used to facilitate the search ,because some patterns some times are repeatead ,so it would be wastefull if you try to repeat regular expressions .
ex:
let repeatStr = "regex regex"; \\here regex is repeated so we should use captrue group
let repeatRegex = /(\w+)\s\1/; \\ this is what they did here (\w+) =to match string regex \s = to match space \1= means this groupe one refers to regex ,because it is repeated
repeatRegex.test(repeatStr); // Returns true
repeatStr.match(repeatRegex); // Returns ["regex regex", "regex"]
and remember to put the capture group between parantheses.