Skip to content
ToolzKit

Developer

Regex Tester

Test regular expressions against sample text with live match and replace previews.

Test string

Matches

0 matches

Matches appear here.

Replace preview

Replacement preview appears here.

Enter a pattern and test string, or load the example.

About the Regex Tester

This tool lets you build and test JavaScript regular expressions against a sample string, showing every match, its index and captured groups, plus a live preview of a replacement string. It's designed for developers iterating on patterns for validation, parsing or text extraction.

How to use it

  1. 01Enter a regular expression pattern (without slashes).
  2. 02Toggle flags such as global, case-insensitive, multiline, dotall or unicode.
  3. 03Paste your test string and review the match list.
  4. 04Enter a replacement pattern using $1, $2 to preview String.replace output.

Features

  • Live match list with index and capture group values
  • All standard JavaScript flags: g, i, m, s, u
  • Replacement preview using capture group references
  • Safeguards against invalid patterns and zero-length match loops

Practical examples

Extracting email addresses

Use a pattern like (\w+)@(\w+\.\w+) to find every email in a block of text and preview a redacted replacement.

Limitations

  • Matches are capped at 500 to keep the browser responsive on pathological patterns or very long input.
  • This uses JavaScript's native regex engine, so PCRE-only features like recursive patterns are not supported.

Privacy

All matching happens locally using your browser's regex engine; your pattern and text are never transmitted.

Read the full privacy policy for how the site as a whole handles data.

Frequently asked questions

Why is the global flag forced on for matching?

The match list needs to find every occurrence, so the tool internally ensures the global flag is set while respecting your other flag choices.

What happens with catastrophic backtracking patterns?

The browser's engine may still hang on pathological patterns; the 500-match cap only limits the number of results collected, not per-match execution time.

Can I use named capture groups?

Yes, they are matched correctly, though the results list currently displays groups by position rather than by name.