#498 · Developer Tool

Regex Group Visualizer

Inspect how a JavaScript regular expression divides its first match into numbered and named capture groups. When the browser supports the indices flag, every group is shown with start and end offsets; unmatched optional groups remain visible as unmatched. This makes nested captures, alternation, and naming mistakes easier to diagnose.

Developer Input

Regex Group Visualizer
Ad space

How to use this developer tool

  1. Enter sample text containing at least one match.
  2. Provide the pattern and flags without slash delimiters.
  3. Visualize the first match and inspect each group value.
  4. Use start and end offsets to check nesting and boundaries.

What this developer tool does

The report maps the full match and each capture group to its value and, when available, its exact span in the source text.

Compile the expression with the d flag when supported, call exec once, then pair match entries with indices and named-group metadata.

Capture groups show the last value captured when a quantified group repeats.

Example

Pattern: (a(b))
Text: ab
Group 0: ab; Group 1: ab; Group 2: b

Use cases

  • Debug nested groups.
  • Teach capture numbering.
  • Verify optional and alternative branches.

Tips for reliable output

  • Use noncapturing (?:...) when a group needs no value.
  • Name important groups.
  • Add d for exact indices in modern browsers.
  • Test optional branches with several inputs.

Processing details

Group zero is the full match. Numbered groups follow opening-parenthesis order; named groups are reported with their names when the engine exposes them.

Only the first match is visualized to keep the group structure focused. Browser support controls whether exact subgroup indices are available.

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