Ambiakshi Tools VerifiedAEO Direct AnswerRegex 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
| Token | Category | Plain-English Meaning |
|---|---|---|
| (?<year>...) | group | Begins named capture group "year" |
| \d | character_class | Matches any digit (0-9) |
| {4} | quantifier | Matches exactly 4 times |
| ) | group | Closes the current group |
| - | literal | Matches literal character "-" |
| (?<month>...) | group | Begins named capture group "month" |
| \d | character_class | Matches any digit (0-9) |
| {2} | quantifier | Matches exactly 2 times |
| ) | group | Closes the current group |
| - | literal | Matches literal character "-" |
| (?<day>...) | group | Begins named capture group "day" |
| \d | character_class | Matches any digit (0-9) |
| {2} | quantifier | Matches exactly 2 times |
| ) | group | Closes 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.
