Problem with Guide solution and challenge solution for Reuse Patterns Using Capture Groups challenge
See original GitHub issueBelow are the current instructions for the Reuse Patterns Using Capture Groups challenge.
Use capture groups in reRegex to match numbers that are repeated only three times in a string, each separated by a space.
Reading through common questions on the forum related to this challenge, there probably should be some modifications to these instructions.
- It should made clearer that the numbers should appear consecutively separated by a space vs just repeated three times. Why? Because in the following string, the same number is repeated 3 times and the numbers are separated by a space, but they are not consecutive.
"42 32 42 42"
- Even if we fix the wording as described above, there is still the issue that the following strings should match, because all 3 of the "42"s are consecutive and separated by a space.
"100 42 42 42"
"42 42 42 100"
"100 42 42 42 100"
"42 42 42 100 100 100"
All the above would fail the currently “accepted” regex solutions (both seen below)
/^(\d+)\s\1\s\1$/
or
/^(\d+) \1 \1$/
Issue Analytics
- State:
- Created 4 years ago
- Comments:14 (13 by maintainers)
Top Results From Across the Web
Reuse Patterns Using Capture Groups - Guide
Reuse Patterns Using Capture Group. Hints. Hint 1. Given code below: let testString = "test test test"; let reRegex = /(test)\s\1/; let ...
Read more >FreeCodeCamp/reuse-patterns-using-capture-groups.english ...
Instructions. Use capture groups in reRegex to match numbers that are repeated only three times in a string, each separated by a space....
Read more >Regular Expressions - Reuse Patterns Using Capture Groups
In this regular expressions tutorial we reuse patters using capture groups. We're using regular expressions in conjunction with JavaScript ...
Read more >Regular Expressions (31/33) | Reuse Patterns Using Capture ...
Regular Expressions (31/33) | Reuse Patterns Using Capture Groups | freeCodeCampFull playlist ...
Read more >Capture groups using reuse patterns - Stack Overflow
Can the string contain any other numbers? Eg 1 2 2 2 , which would be a match, or is that not possible?...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think the word
only
needs to be in there, otherwise,32 42 42 42
would still apply.@Sky020 Since this is different issue, I think it is fine as a stand-alone issue.