Regex Tester

Test regular expressions

/ /

What Is This Tool?

The Regex Tester lets you write a regular expression, choose flags, and test it live against a block of text. Matches are highlighted directly in your text, and capture groups are broken out into a table. Everything runs locally using your browser's own regular expression engine — nothing is uploaded.

How to Use

1

Type your pattern (without the surrounding slashes) into the Pattern field.

2

Toggle the g / i / m / s flags as needed.

3

Paste your test string below — matches highlight automatically.

4

Check the capture group table for detailed group values.

Features

  • Live highlighting of matches as you type
  • Supports g, i, m, and s flags
  • Capture group breakdown per match
  • Clear error messages for invalid patterns
  • Copy a plain-text summary of all matches
  • 100% client-side — nothing leaves your browser

Examples

Pattern: (\w+)@(\w+)\.com with flag g

Test string:

Contact ada@example.com or grace@sample.com for details.

This highlights both email addresses and lists the username and domain as capture groups for each match.

Common Use Cases

  • Debugging a regular expression before using it in code
  • Extracting structured data like emails, dates, or IDs from text
  • Validating input formats such as phone numbers or postal codes
  • Learning how regex flags and capture groups behave

Frequently Asked Questions

Is my test string uploaded anywhere?

No. Matching happens locally using your browser's built-in JavaScript regular expression engine. Nothing is sent to a server.

Do I need to include the slashes around my pattern?

No. Type just the pattern itself, such as \d+, and use the flag checkboxes for g, i, m, and s instead of typing them after a slash.

What happens if my pattern is invalid?

The tool catches the syntax error and shows a clear message explaining what's wrong, instead of breaking the page.

Why do I need the g flag to see all matches?

Without the global (g) flag, JavaScript regular expressions only report the first match. Enable g to find every occurrence in the text.

What does the capture group table show?

If your pattern has parentheses (capture groups), each match's group values are listed by index alongside the full matched text.

Which regex flavor does this use?

It uses standard JavaScript (ECMAScript) regular expression syntax, since matching runs entirely in your browser.