1. [Home](https://www.toolcomb.com/)
2. [Text Tools](https://www.toolcomb.com/text-tools)
3. Regex Named Capture Tester

# Regex Named Capture Group Tester - Test (?<name>...) Online Free

Free online regex named capture group tester. Enter a pattern with (?<name>...) syntax, flags, and a test string. Highlight matches, inspect numbered and named groups in a table, copy matches as JSON - browser-only.

### Pattern & flags

Regular expression _(?\<name\>...)_

g global

i ignore case

m multiline

s dotAll

u unicode

y sticky

### Test string

_Release 2024-03-15 shipped. Backup dated 2023-11-01 remains._

Copy matches JSON  Clear

### Highlights (2 matches)

```
Release 2024-03-15 shipped.
Backup dated 900/60 px-0.5 rounded-sm">2023-11-01 remains.
```

### Capture groups

| # | Match | Index | Numbered | Named |
| --- | --- | --- | --- | --- |
| 1 | 2024-03-15 | 8 | [1]=2024 [2]=03 [3]=15 | year=2024, month=03, day=15 |
| 2 | 2023-11-01 | 41 | [1]=2023 [2]=11 [3]=01 | year=2023, month=11, day=01 |

## What is a regex named capture group tester?

A regex named capture group tester is a browser tool that runs a regular expression against sample text and shows what each (?<name>...) segment captured. Instead of mentally mapping group 1 to “year” and group 2 to “month,” you see labeled keys beside every match. This page is built for that workflow: paste a pattern, paste a log line or URL, and read a table of named and numbered captures without writing a throwaway script.

Named captures shine when patterns parse semi-structured strings. ISO dates, query strings, user agents, invoice numbers, and Kubernetes pod names all benefit from readable group labels. Numbered groups still exist - parentheses increment indices in source order - but namedGroups.year is easier to discuss in code review than “capture three.” The tester highlights every match in the test string and lists each occurrence as its own row so global searches do not collapse into one ambiguous summary.

This tool is intentionally separate from ToolComb’s general regex tester at /regex-testing. That page optimizes for broad pattern exploration, samples, and layout flexibility. Here the copy actions and UI center on (?<name>...) syntax and JSON export of captures. If you only need yes/no matching, either page works; if you are documenting a parser or writing test fixtures from real logs, start here.

Errors are first-class. Invalid group names, dangling backslashes, and unbalanced parentheses surface a clear message immediately. That saves a trip through stack traces when a teammate pastes a pattern with unsupported features.

Privacy matches other ToolComb text tools: nothing is posted to a server. Security teams can paste redacted production samples locally. You should still avoid pasting live secrets; the guarantee is local execution, not magic scrubbing.

Copy matches JSON serializes match, index, groups, and namedGroups for each hit. Drop the array into Jest snapshots, OpenAPI examples, or internal runbooks. The format is plain JSON - no proprietary wrapper - so jq and Python json.loads consume it directly.

Flags control whether the tool finds all matches, ignores case, treats line starts separately, lets dots cross newlines, supports Unicode-aware patterns, or anchors matching at the current position. Toggle them to match the behavior you expect in your application.

Understanding numbered versus named groups prevents off-by-one bugs. Group 0 is always the full match in API terms, while match[1] is the first parenthesized capture. Named groups occupy the same numbering sequence as if you had only parentheses - (?<a>x)(?<b>y) still yields match[1] and match[2] plus groups.a and groups.b. When you refactor a pattern to insert a new named group in the middle, downstream code that relied on numeric indices breaks unless you update references; names stabilize refactors because destructuring follows labels.

Lookahead and lookbehind assertions can wrap naming decisions. A pattern like (?<protocol>https?)://(?<host>[\w.-]+) keeps protocol and host labeled even when a non-capturing cluster (?:...) sits between optional www. and the host. Non-capturing groups do not appear in the table - only capturing parentheses and named captures - which keeps the UI focused on data you will actually extract in application code.

For security reviewers, local testing reduces the temptation to paste production payloads into cloud regex sites with unknown retention policies. You still must treat pasted secrets carefully, but the attack surface is your own browser tab rather than a third-party SaaS analytics pipeline.

Educators use named capture tables to bridge syntax cheat sheets and runnable examples. Showing match.groups beside highlighted text connects abstract grammar rules to concrete substrings students can click-copy into assignments.

Microservice teams parsing trace IDs and correlation headers often encode structure in a single string. Named groups document which segment is tenant, shard, and sequence without maintaining a separate parsing spec that drifts from the regex in repo.

## How to test named capture groups online

You can validate a named-group parser in under two minutes. Follow these steps when porting patterns from docs, logs, or code review comments.

1. **Write the pattern without slashes**

Enter only the pattern body - not /pattern/flags. Wrap each capture you want labeled in (?<label>subpattern). Example: (?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2}) for a simple date triplet.
2. **Enable the flags your code uses**

Turn on g when you expect multiple matches in one string. Use i for case-insensitive hostnames or hex. Use m for multiline logs where ^ should match line starts. Misaligned flags are the most common reason captures differ between this tester and your app.
3. **Paste representative test text**

Use real shapes: trailing spaces, Unicode, or multiple matches on one line. The highlight panel shows where the engine stopped; empty tables mean no match or an overly strict anchor.
4. **Read the groups table**

Each row is one match. Numbered groups appear in order; named groups appear as key-value pairs. Compare namedGroups to what you destructure in code: const { year, month, day } = match.groups.
5. **Fix errors and iterate**

If a red error banner appears, read the syntax hint - often an unescaped + in a literal or a space inside (?<bad name>). Adjust and watch the table repopulate live.
6. **Export JSON for tests**

Primary Copy matches JSON places the full result set on the clipboard. Paste into a test file or ticket so reviewers see exact indices and capture values.

## Before / after: parsing access-log timestamps

### Before

A backend engineer inherits a regex that should pull timestamp, method, and path from nginx-style lines but group indices are undocumented. Python examples online use (?P<time>...) while the Node service uses (?<time>...). Unit tests need sample captures.

### After

They paste the JavaScript pattern with (?<time>...) and three sample log lines, enable g, and confirm three rows with identical named keys. Copy matches JSON goes into the test fixture; code review references names instead of numbers.

The same flow works for semver strings, Git ref names, and E.164 phone fragments - anywhere labeled captures beat counting parentheses.

## When to use a named capture regex tester

### 1. Porting patterns from Python or .NET

Translate (?P<name>...) to (?<name>...) then verify captures before merging. Small syntax differences cause big silent bugs.

### 2. Documenting log parsers

Support teams attach JSON exports showing which named group holds request IDs, making runbooks readable for non-regex specialists.

### 3. Writing Jest or Vitest fixtures

Copy structured match output instead of hand-typing expected groups arrays.

### 4. Teaching regex in workshops

Students see labels update live when they rename (?<city>...) without reordering parentheses.

### 5. Validating URL and email extractors

Confirm optional groups and named submatches behave with and without global flag before shipping validators.

### 6. Debugging sticky and multiline modes

Toggle m and y to see how anchors shift capture boundaries on multiline config files.

### 7. Reviewing PR regex changes

Paste old and new patterns with the same sample string; compare tables side by side in two tabs.

### 8. Preparing OpenAPI examples

Named captures from real payloads become realistic field examples in API docs.

### 9. Extracting invoice and PO fields

Finance automation prototypes use (?<invoice>...) and (?<amount>...) against pasted PDF text exports to validate labels before OCR integration.

### 10. Kubernetes and container IDs

Platform teams test patterns against pod name and namespace strings, ensuring named groups align with alert routing templates.

## Named capture testers compared

You can test named groups in REPLs, IDE extensions, or dedicated sites. Differences are flavor, export, and privacy.

| Option | Engine | Named groups | Best for |
| --- | --- | --- | --- |
| ToolComb named capture tester | JavaScript RegExp | Table + JSON export | Node/browser parser dev |
| Browser console | JavaScript RegExp | Manual logging | One-liner checks |
| regex101.com | Selectable flavors | Varies by flavor | Multi-language PCRE |
| IDE regex plugin | Project-dependent | Inline | Editing inside repo |

Use regex101 when you need PCRE or Rust flavors. Use this page when your production code is JavaScript and you want ToolComb’s privacy model plus capture JSON on one click.

## Limits and tips

- Engine is ECMAScript only - no Python (?P<name>), .NET balancing groups, or PCRE possessive quantifiers.
- Very large test strings with many global matches may feel slow on low-end devices.
- Highlight HTML escapes < in matched text; always verify binary-safe logs separately.
- Lookbehind patterns must be fixed-width in JavaScript.
- Invalid group names (digits-only or hyphenated wrongly) fail at construction time.
- Copy JSON uses pretty-printed two-space indent; minify if size matters.
- Sticky flag without careful lastIndex can yield zero matches - compare with g on.
- This page does not replace lint rules or static analysis for ReDoS risks.
- Backreferences to named groups inside the same pattern use \k<name> in ECMAScript - test those patterns here to confirm the backreference consumes the expected substring.
- Duplicate group names in one pattern are a syntax error in JavaScript; split testing across iterations if you refactor names.

## Privacy: local regex execution

Patterns and test strings are evaluated with client-side JavaScript only. ToolComb does not receive your paste content.

That suits internal URLs, customer emails in support tickets, and pre-release feature flags embedded in sample configs.

Clear resets all fields; closing the tab drops in-memory results.

Copy matches JSON is an explicit clipboard action - nothing syncs automatically to cloud notes.

Named group tables render from in-memory match results; no server-side HTML rendering sees your samples.

Regex patterns under NDA stay in your tab when validating captures before release.

Use devtools Network tab to confirm zero content uploads while editing pattern fields.

Training environments can demo (?<name>...) syntax without provisioning shared backend log sinks.

## Frequently Asked Questions

### What is a named capture group in regex?

A named capture group wraps part of a pattern in (?<name>...) so the matched substring is available under name in match.groups as well as by index in match[i]. It makes parsers for dates, URLs, and log lines easier to read than remembering which number is the month.

### How is this different from the general regex tester?

ToolComb’s regex-testing page covers broad pattern debugging with samples and fullscreen layout. This page is dedicated to named and numbered capture inspection: a groups table, JSON export, and SEO content focused on (?<name>...) workflows for JavaScript developers.

### Which regex engine does this tool use?

JavaScript’s built-in RegExp (ECMAScript). Named groups use (?<name>pattern). Python uses (?P<name>pattern) instead - translate before pasting here if you are porting patterns.

### Why do I see an invalid regular expression error?

Unclosed parentheses, unknown escapes, invalid group names, or unsupported constructs for your flag set trigger a clear error message. Fix the pattern or enable the u flag for some Unicode property escapes.

### Do numbered groups still appear when I use named groups?

Yes. Parentheses still produce numbered captures in order. Named groups occupy the same numbering scheme; the table shows both index columns and the named map for each match.

### Can I test without the global flag?

Yes. With g off, only the first match is returned - useful when you are validating a single occurrence or anchoring with ^ and $.

### Is my test string uploaded?

No. Matching runs entirely in your browser. Logs and PII you paste never leave your device.

### What does Copy matches JSON include?

A JSON array of objects with match text, index, groups array, and namedGroups object for each match - ready to paste into tests or notebooks.

### Are lookbehind and lookahead supported?

Yes, when your browser supports ES2018+ features. They do not create capture groups unless you wrap subpatterns in capturing parentheses.

### Is this named capture regex tester free?

Yes. Unlimited local tests, no account, and no watermark on copied JSON.

### Can I use named groups with String.replace?

Yes. After validating captures here, use the same pattern in replace with $<name> or $1 in the replacement string. ToolComb’s find-and-replace tool supports that workflow when you need to rewrite matched segments using labeled groups rather than numeric indices alone.

### What characters are valid in a group name?

ECMAScript group names use JavaScript identifier rules: they must start with a letter, underscore, or dollar sign, followed by letters, digits, underscores, or dollar signs. Names like 2024 or my-group are invalid and throw at pattern construction - rename to year2024 or my_group before testing.

## Related text tools

- [Regex Tester](https://www.toolcomb.com/regex-testing) - General live regex debugging with samples.
- [Find and Replace](https://www.toolcomb.com/find-and-replace) - Apply replacements after you validate captures.
- [Diff Checker](https://www.toolcomb.com/diff-checker) - Compare pattern changes line by line.
- [Word Counter](https://www.toolcomb.com/word-counter) - Measure log or document size before regex batch jobs.

## Related Tools

Discover more free tools that might help with your next task.

[Case Converter Convert text between upper, lower, title cases and more Use Tool](https://www.toolcomb.com/case-converter)

[HTML ↔ Markdown Converter Convert between HTML and Markdown Use Tool](https://www.toolcomb.com/html-markdown-converter)

[Lorem Ipsum Generator Generate placeholder text for design and content Use Tool](https://www.toolcomb.com/lorem-ipsum-generator)

[Regex Testing Test and validate regular expressions Use Tool](https://www.toolcomb.com/regex-testing)

[Word Counter Count words, characters, and reading time instantly Use Tool](https://www.toolcomb.com/word-counter)

[Cron Expression Generator Build and explain crontab schedules in plain English Use Tool](https://www.toolcomb.com/cron-expression-generator)

### Related guides

Read the how-to, then come back to this tool when you are ready to run it locally.

- [Find and Replace with Regex Safely in the Browser Test patterns first, copy before replace, watch greed and backreferences - bulk edit text locally without uploading files or deleting your backup.](https://www.toolcomb.com/blog/find-and-replace-with-regex-safely)
- [Regex Named Capture Groups Explained (?<name>...) syntax, backreferences in replace strings, and debugging named groups in the browser before bulk find-and-replace.](https://www.toolcomb.com/blog/regex-named-capture-groups-explained)
- [Best Free Developer Text Tools in the Browser Word counts, diffs, cron, Markdown, slugs, regex replace, SQL format, and JS minify - when to open each ToolComb text tool locally without uploading source.](https://www.toolcomb.com/blog/best-free-developer-text-tools)

[View All Tools](https://www.toolcomb.com/tools)
