question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Problem with Guide solution and challenge solution for Reuse Patterns Using Capture Groups challenge

See original GitHub issue

Below 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.

  1. 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"
  1. 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:closed
  • Created 4 years ago
  • Comments:14 (13 by maintainers)

github_iconTop GitHub Comments

2reactions
RandellDawsoncommented, Dec 6, 2020

Use capture groups in Regex to match a string that consists of the same number repeated exactly three times.

I think the word only needs to be in there, otherwise, 32 42 42 42 would still apply.

Use capture groups in reRegex to match a string that consists of only the same number repeated exactly three times separated by single spaces.

1reaction
RandellDawsoncommented, Dec 6, 2020

@Sky020 Since this is different issue, I think it is fine as a stand-alone issue.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found