#499 · Developer Tool

Regex Named Group Extractor

Turn repeated JavaScript regex matches into records keyed by named capture groups. The extractor discovers group names from actual matches, preserves unmatched optional groups as null, and emits formatted JSON plus tabular export data. It works well for log lines, filenames, migration text, and other semi-structured input.

Developer Input

Regex Named Group Extractor
Ad space

How to use this developer tool

  1. Paste the records to parse.
  2. Enter a pattern containing one or more (?<name>...) groups.
  3. Choose flags; global matching is added for extraction.
  4. Run the tool and review the JSON records and unmatched counts.

What this developer tool does

The JSON output contains one object per match, with properties taken directly from named capture groups.

Execute the pattern globally, read match.groups for each result, normalize undefined captures to null, and attach the full match index.

Duplicate group names and their availability depend on the JavaScript engine and pattern structure.

Example

Pattern: (?<key>\w+)=(?<value>\w+)
Input: mode=dark
Output: {"key":"mode","value":"dark"}

Use cases

  • Parse structured log lines.
  • Extract fields from filenames.
  • Prototype text-to-JSON migrations.

Tips for reliable output

  • Use descriptive group names.
  • Anchor line records with ^ and $ plus m.
  • Make delimiters explicit.
  • Review null values from optional branches.

Processing details

The global iterator collects named groups only. Every record also carries the zero-based match index in the JSON metadata returned by the page.

Patterns without named groups are rejected. A 10,000-match cap prevents runaway result generation.

Frequently asked questions

Which regular expression syntax is supported?

Patterns use the JavaScript regular expression engine available in your browser.

What happens when the pattern is invalid?

The tool reports the JavaScript syntax error and does not process the input text.

Can a regular expression freeze the page?

Pathological patterns can cause catastrophic backtracking. Test untrusted patterns on small input first.

Are matches evaluated by Unicode code point?

Only when the Unicode-related flag and pattern semantics call for it; otherwise JavaScript uses UTF-16 code units.

Does the tool send pattern or text to a server?

No. Matching and replacement run in the current browser tab.

Output fields

FieldMeaning
SummaryHigh-level processing result
StatisticsCounts and validation details
ExportCopy-ready text plus structured data when available

Code Formatting & Regex tools

Browse more tools for code formatting & regex.

Open category hub