Regex Tester — Live, Free, Browser-Only
Overview
Writing a regex to extract emails from a log file, validate an Indian phone number format, or parse ISO 8601 timestamps is tedious without instant feedback. This tester shows every match highlighted in the test string, lists capture groups by position, and lets you preview a replacement string — all as you type. Eight common patterns (email, URL, UUID, IPv4, hex color, JWT) are pre-loaded in the dropdown.
How to Use This Tool
Enter your pattern in the pattern field. Toggle flags using the g, i, m, s, u, y buttons. Paste your test string below. Matches appear highlighted immediately — click any highlight to see its position and capture groups in the match list. Switch to Replace mode to preview a substitution.
Ready to get started? It's free, no registration required, and your files never leave your device.
PDF Tool →Frequently Asked Questions
What is the catastrophic backtracking guard?
Certain regex patterns — like (a+)+$ applied to a long string — cause exponential backtracking that freezes the browser. The guard wraps the match loop in a 50ms deadline check. If the loop times out, the tool stops and shows a warning instead of hanging the tab.
How do I reference capture groups in the replacement string?
Use $1, $2, etc. for numbered capture groups. For named groups defined with (?<name>...), use $<name> in the replacement. The full match can be inserted with $&. These are standard JavaScript replacement syntax supported by String.prototype.replace().
Can I test regex against multi-line strings?
Yes. Paste multi-line text into the test string area. Enable the m flag to make ^ and $ match line boundaries instead of the full string boundary. Enable s to make . match newline characters.