Change:
# --description-- <del> Some patterns you search for will occur multiple times in a string. It is wasteful to manually repeat that regex. There is a better way to specify when you have multiple repeat substrings in your string. </del> <ins> Say you want to match a word that occurs multiple times like below. </ins> <del> You can search for repeat substrings using <dfn>capture groups</dfn>. Parentheses, `(` and `)`, are used to find repeat substrings. You put the regex of the pattern that will repeat in between the parentheses. </del> <ins> ```js let repeatStr = "row row row your boat"; ``` You could use `/row row row/`, but what if you don't know the specific word repeated? <dfn>Capture groups</dfn> can be used to find repeated substrings. Capture groups are constructed by enclosing the regex pattern to be captured in parentheses. In this case, the goal is to capture a word consisting of alphanumeric characters so the capture group will be `w+` enclosed by parentheses: `/(w+)/`. </ins> <del> To specify where that repeat string will appear, you use a backslash (``) and then a number. This number starts at 1 and increases with each additional capture group you use. An example would be `1` to match the first group. </del> <ins> The substring matched by the group is saved to a temporary "variable", which can be accessed within the same regex using a backslash and the number of the capture group (e.g. `1`). Capture groups are automatically numbered by the position of their opening parentheses (left to right), starting at 1. </ins> <del> The example below matches any word that occurs twice separated by a space: </del> <ins> The example below matches a word that occurs thrice separated by spaces: </ins> ```js <del> let repeatStr = "regex regex"; let repeatRegex = /(w+)s1/; repeatRegex.test(repeatStr); repeatStr.match(repeatRegex); </del> <ins> let repeatRegex = /(w+) 1 1/; repeatRegex.test(repeatStr); // Returns true repeatStr.match(repeatRegex); // Returns ["row row row", "row"] </ins> ``` <del> The `test` call would return `true`, and the `match` call would return `["regex regex", "regex"]`. </del> <ins> Using the `.match()` method on a string will return an array with the matched substring, along with its captured groups. </ins> <del> Using the `.match()` method on a string will return an array with the string it matches, along with its capture group. </del> # --instructions--

Discussion:
<!-- NOTE: If you're reporting a security issue, don't create a GitHub issue. Instead, email We will look into it immediately. --Describe your problem and how to reproduce it: I found the challenge Regular Expressions: Reuse Patterns Using Capture Groups does not give an adequate description of what capture groups do, I would suggest firstly: restructuring the description so that it gives an adequate introduction, e.g. likening them to variables in that they are references to a portion of the Regex. Showing that we can reference them with and depending on whether it's used outside the regex or within it, respectively. AND ONLY THEN describing that "Some patterns you search for will occur multiple times in a string. It is wasteful to manually repeat ..." Add a Link to the page with the problem: Regular Expressions: Reuse Patterns Using Capture Groups Tell us about your browser and operating system: Browser Name: Browser Version: Operating System: If possible, add a screenshot here (you can drag and drop, png, jpg, gif, etc. in this box):
I don't see a huge problem with how it is now. Certainly things could always be better. If you or someone else wants to give it a slight rewrite and make a PR, I wouldn't object - there are a number of forum posts on this challenge.
I agree with some criticisms that were raised. Thanks for sharing. Here is my suggested changes.