Ambiakshi Tools VerifiedAEO Direct Answer

Regex Capture Groups Explained

Capture groups in regular expressions isolate sub-matches within parentheses. Numbered groups like (\d{3}) are indexed sequentially ($1, $2), while named groups like (?<area>\d{3}) assign self-documenting dictionary keys. Non-capturing groups (?:...) group tokens for quantifiers without saving memory.

(?<name>pattern) = Named Group; (pattern) = Numbered Group; (?:pattern) = Non-Capturing Group

Runs 100% on this deviceECMAScript RegExp
Presets:
Regular Expression Pattern
//g
Flags:
Test String
81 characters
2 matches·2 recorded
TokenCategoryPlain-English Meaning
(?<year>...)groupBegins named capture group "year"
\dcharacter_classMatches any digit (0-9)
{4}quantifierMatches exactly 4 times
)groupCloses the current group
-literalMatches literal character "-"
(?<month>...)groupBegins named capture group "month"
\dcharacter_classMatches any digit (0-9)
{2}quantifierMatches exactly 2 times
)groupCloses the current group
-literalMatches literal character "-"
(?<day>...)groupBegins named capture group "day"
\dcharacter_classMatches any digit (0-9)
{2}quantifierMatches exactly 2 times
)groupCloses the current group

Frequently asked

Direct answers for search, answer engines, and generative crawlers.

Capturing groups (pattern) store matched text into memory buffers and backreferences ($1). Non-capturing groups (?:pattern) group expressions for quantifiers without allocating capture index overhead.

More Regex workbench answers