Vaultools
Menu

Regex capture group

A capture group is a part of a regular expression wrapped in parentheses that both groups its contents and remembers the text it matched, so you can extract it, reuse it later in the pattern with a backreference, or refer to it in a replacement.

The basics

Parentheses create a numbered group. Groups are numbered by the position of their opening parenthesis, left to right, and group 0 is always the whole match.

Pattern: (\d{4})-(\d{2})-(\d{2}) applied to 2026-09-18:

GroupText
02026-09-18
12026
209
318

Variations

Common pitfalls

References

Ads on this page

Non-personalized ads help keep Vaultools free — Google decides where they appear on the page.

Go Pro to remove them →