Regex Tester
Live regex matching, groups and replace preview.
Use the Regex Tester tool
What this regex tester does
Regex Tester evaluates a JavaScript regular expression against sample text and highlights every match as you type. Each match lists its capture groups and named groups, and a replace preview shows the result of using $1 or $<name> references.
Catastrophic backtracking can hang a browser tab. This tester runs matching inside a Web Worker and cancels the job after a short time limit, so a pathological pattern produces an error instead of a frozen page.
Why use it
- Build and debug validation patterns before adding them to application code.
- See exactly which capture groups a pattern produces.
- Check the effect of the global, multiline, dotAll, unicode and sticky flags.
How to use it
- 1Enter a pattern without the surrounding slashes.
- 2Change flags using the toggle buttons.
- 3Type or paste the test text and review highlighted matches.
- 4Optionally enter a replacement string to preview the transformed text.
Worked examples
Find ISO dates
Input
Pattern: \b\d{4}-\d{2}-\d{2}\b · Text: shipped 2026-11-08, due 2026-12-01Output
2 matches: 2026-11-08, 2026-12-01
Extract key/value pairs
Input
Pattern: (\w+)=(\w+) · Text: id=42 role=admin
Output
Match 1 → $1: id, $2: 42 · Match 2 → $1: role, $2: admin
Common mistakes
- Forgetting that JavaScript regex has no \A or \Z anchors — use ^ and $ with the multiline flag carefully.
- Using a global regex with .test() in a loop without resetting lastIndex.
- Validating email addresses with an enormous pattern instead of a simple check plus a verification email.
Frequently asked questions
Which regex flavour is used?
Why did my pattern time out?
Are named groups supported?
Related tools
All toolsJSON Formatter
Beautify or minify JSON, with precise error positions.
URL Encoder
Percent-encode values or whole URLs, correctly.
Hash Generator
MD5 and SHA digests for text or files, computed locally.
JSON Validator
Pinpoint JSON errors by line and column, instantly.