πŸ”

Regex Tester

Test regular expressions live with real-time match highlighting. ReDoS-safe β€” runs in a Web Worker with 2s timeout.

Regular Expression
/ / g
Test String
Matches
Enter a pattern and test string to see matches

About Regex Tester & Debugger

This tool lets you test and debug regular expressions in real time directly in your browser. Type or paste a pattern and a test string, toggle flags like global, case-insensitive, multiline, and dotAll, and instantly see every match highlighted in place with group captures listed below.

All matching runs inside a Web Worker with a 2-second timeout to protect against catastrophic backtracking (ReDoS). No data leaves your browser β€” your patterns and strings are never sent to any server.

Common Use Cases

How to Use

  1. Type your regex pattern in the pattern field between the two forward slashes
  2. Toggle the flags (g, i, m, s) using the checkboxes on the right β€” or use a preset like "Email" or "URL"
  3. Paste or type your test string in the Test String panel on the left
  4. Matches are highlighted instantly; expand the Matches panel to see each match's position and capture groups

Frequently Asked Questions

Why does the tester stop after 2 seconds?

Certain regex patterns combined with specific inputs can cause exponential backtracking β€” this is called ReDoS. To protect your browser from freezing, the regex runs in a separate Web Worker and is automatically killed after 2 seconds, displaying a timeout warning.

What does the "g" flag do and when should I turn it off?

The global flag (g) tells the engine to find all matches in the string. Without it, only the first match is returned. Turn it off when you want to test whether a pattern matches the beginning of a string, or when you are testing anchored patterns like ^...$.

How do I test named capture groups?

Named capture groups use the syntax (?<name>...). The tester currently displays all capture groups (numbered) in the Matches list. Named groups are part of standard JavaScript regex and will be captured and shown alongside positional groups.

Advertisement