Capture Group

Noun · Development

Definitions

  1. A parenthesized subpattern in a regular expression whose matched text is retained so it can be referenced later by index or name. Capture groups are useful for extracting pieces of structured text, but too many nested groups can make patterns hard to read and maintain.

    In plain English: A part of a regular expression that saves the text it matched.

    Example: "The parser used named capture groups to extract the date, severity, and request ID from each log line without writing a custom tokenizer."

Related Terms