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.

Mark specific RegExp group, not whole match

See original GitHub issue

Is your feature request related to a problem? Please describe. Let’s say you have a string: “1) You have 12 points.” And you want to mark the number. But you don’t want to mark all numbers, only the one before word “points”.

Describe the solution you’d like One solution could be adding a groupNumber: number to the options object which would specify a group from the regexp. So one could write a regexp like /(\d+) points/ and pass 0 as a group number.

Additional context Test in console: "1) You have 12 points.".match(/(\d+) points/)[1]

PS: thank you for making this amazing library!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
Juraj-Masiarcommented, Aug 20, 2021

Wow, the time flies 😃 I would still like to see a group number support. But no rush, I’m busy myself 😃

0reactions
stale[bot]commented, Oct 20, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is a non-capturing group in regular expressions?
The non-capturing group (?...) does not remove any characters from the original full match, it only reorganises the regex visually to the ...
Read more >
Capturing groups - The Modern JavaScript Tutorial
The method str.match(regexp) , if regexp has no flag g , looks for the first match and returns it as an array: At...
Read more >
2.4: Regular Expressions: Capturing Groups - YouTube
In this video I discuss capturing parentheses and how they are used to create numbered groups that referenced in a find / replace...
Read more >
The Question Mark Makes the Preceding Token Optional
The question mark gives the regex engine two choices: try to match the part the question mark applies to, or do not try...
Read more >
Non-Capturing Regex Groups in Java - Baeldung
Although they don't save the matched character sequence, non-capturing groups can alter pattern matching modifiers within the group. Some non- ...
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