Regex Named Group Extractor

Named capture groups turn a regex into a tiny parser: instead of remembering that group 2 is the year and group 3 is the month, you label them (?<year>\d{4}). Paste a pattern with named groups and some text, and this tool extracts every match into a clean JSON array and a readable table, keyed by the names you chose. It runs entirely in your browser.

Global matching is always on.

How to use the Regex Named Group Extractor

Write a pattern that includes one or more named groups using the (?<name>…) syntax, then paste the text you want to scan. The tool finds every match globally and builds two views: a table with one row per match and a column per group name, and a JSON array where each match becomes an object keyed by your group names — ready to copy into code or a fixture.

The flag checkboxes map to the standard JavaScript regex flags: i for case-insensitive, m so ^ and $ match at line breaks, s so . also matches newlines, and u for full Unicode handling. Global matching is always enabled so you get every occurrence, not just the first. If a group does not participate in a particular match it appears as null, which is exactly how JavaScript reports an optional group that did not fire.

Everything is computed locally as you type — nothing is uploaded — so you can safely extract fields from logs, IDs, or other sensitive text. Use Copy JSON to grab the structured result.

Why named groups beat numbered ones

A capture group is the part of a regular expression wrapped in parentheses whose matched text is remembered for later use. Traditionally those groups are numbered by the order of their opening parenthesis: (\d{4})-(\d{2})-(\d{2}) gives you group 1, 2, and 3. That works until the pattern grows, you insert a group in the middle, and suddenly every downstream reference is off by one. Numbered groups are positional, and position is fragile.

Named groups fix this by attaching a label to a group with the (?<name>…) syntax. Now (?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2}) yields year, month, and day regardless of where they sit in the pattern. In JavaScript these surface on the match object's .groups property as a plain object; in Python they appear via match.groupdict(); .NET, PCRE, Java, and Go all support the same idea with minor syntax differences. The payoff is self-documenting patterns and code that reads m.groups.year instead of the cryptic m[1].

Extraction is one of the most common real uses of regex — pulling structured fields out of semi-structured text such as log lines, filenames, URLs, or identifiers. When you do this at scale, you want the result as data, not as a flat list of strings, and named groups are what make that mapping clean. This tool leans into that workflow: it does not just tell you whether the pattern matches, it returns the captured fields as JSON objects you can drop straight into a test fixture, a config, or a quick script. A note on the names themselves: group names must be valid identifiers and must be unique within the pattern, so if two branches need the same name you will need to restructure rather than reuse it.

Common use cases

  • Parsing log lines. Extract timestamp, level, and message into named fields for quick inspection.
  • Breaking down identifiers. Split a structured ID, SKU, or filename into its meaningful parts.
  • Building test fixtures. Turn sample text into JSON objects you can paste into tests.
  • Designing a parser. Prototype a named-group pattern and confirm each field captures what you expect.

Frequently asked questions

What named-group syntax does it use?

The JavaScript syntax (?…). This is also accepted by .NET, PCRE, and others. Python uses (?P…) — convert those to the angle-bracket form here.

What happens if my pattern has no named groups?

It still runs, but the JSON objects will be empty since there are no names to key by. Add (?…) around the parts you want to capture.

Why does a group show as null?

That group did not participate in that particular match — typically an optional group or one inside an alternation branch that was not taken. JavaScript reports these as null.

Is my text sent to a server?

No. The regex runs in your browser using the native engine, so logs and other sensitive text never leave your machine.