Top "Capturing-group" questions

Capturing groups are regular expression constructs that makes use of capturing in regex to capture parts of the matched string during a match sequence in the regexp pattern.

What is a non-capturing group in regular expressions?

How are non-capturing groups, i.e. (?:), used in regular expressions and what are they good for?

regex capturing-group regex-group
Vim Regex Capture Groups [bau -> byau : ceu -> cyeu]

I have a list of words: bau ceu diu fou gau I want to turn that list into: byau cyeu …

regex vim capturing-group regex-group
Scala capture group using regex

Let's say I have this code: val string = "one493two483three" val pattern = """two(\d+)three""".r pattern.findAllIn(string).…

regex string scala capturing-group
What does this Django regular expression mean? `?P`

I have the following regular expression (regex) in my urls.py and I'd like to know what it means. Specifically …

python regex django capturing-group
Regex optional capturing group?

After hours of searching I decided to ask this question. Why doesn't this regular expression ^(dog).+?(cat)? work as I …

regex optional capturing-group
How to capture an arbitrary number of groups in JavaScript Regexp?

I would expect this line of JavaScript: "foo bar baz".match(/^(\s*\w+)+$/) to return something like: ["foo bar baz", "…

javascript regex repeat capturing-group
Why does re.sub replace the entire pattern, not just a capturing group within it?

re.sub('a(b)','d','abc') yields dc, not adc. Why does re.sub replace the entire capturing group, …

python regex python-3.x replace capturing-group
Get index of each capture in a JavaScript regex

I want to match a regex like /(a).(b)(c.)d/ with "aabccde", and get the following information back: "a" …

javascript regex capturing-group
How can we match a^n b^n with Java regex?

This is the second part of a series of educational regex articles. It shows how lookaheads and nested references can …

java regex capturing-group lookaround nested-reference
Scala regex Named Capturing Groups

In scala.util.matching.Regex trait MatchData I see that there support for groupnames , I thought that this was related …

regex string scala pattern-matching capturing-group