Test Regex Capture Groups Online

Overview

Capture groups are the foundation of structured extraction — pulling year, month, and day from a date string, isolating the domain from a URL, or extracting semantic version components from a package string. This tester shows every capture group value for every match, labelled Group 1, Group 2, and so on, directly in the match list. Named groups defined with (?<name>...) appear the same way.

How to Use This Tool

Write a pattern with at least one capture group: for example, (\d{4})-(\d{2})-(\d{2}) to capture year, month, day from an ISO date. Paste a test string with several dates. Each match in the list expands to show Group 1, Group 2, Group 3 values. Enable Replace mode and use $1/$2/$3 or $<name> to reformat.

Ready to get started? It's free, no registration required, and your files never leave your device.

PDF Tool

Frequently Asked Questions

What is a non-capturing group and when should I use it?

A non-capturing group (?:...) groups part of the pattern for quantifiers or alternation without creating a capture. Use it when you need grouping logic but don't want the group to appear in $1, $2 numbering — this keeps your capture group indices predictable.

What happens when a capture group inside an alternation doesn't match?

The group's value is undefined. For example, (a)|(b) applied to 'b' produces Group 1: undefined, Group 2: 'b'. The tool displays undefined groups explicitly so you can see which branch matched.

Are named capture groups supported in all browsers?

Named capture groups ((?<name>...)) are supported in Chrome 64+, Firefox 78+, Safari 11.1+, and Edge 79+. All mainstream browsers released after 2018 support them. The tool uses the native RegExp engine, so support matches your browser version.