Regex Tester
Write a pattern, toggle the g, i, m, s, u and y flags and see every match highlighted in your test text as you type. A table lists each match with its index, numbered groups and named groups, and the replace preview shows the result of $1 or $<name> substitutions. Matching runs in a background worker with a time limit, so a runaway pattern cannot freeze the page.
How to use the Regex Tester
- Type your regular expression in the pattern box.
- Toggle the flags you need.
- Paste test text and watch matches highlight live.
- Review groups in the match table.
- Enable Replace preview to test a replacement string.
Features
- Live highlighting of all matches
- Flags g, i, m, s, u and y
- Numbered and named capture groups in a table
- Replace preview with $1, $<name> and $& support
- Friendly explanations of syntax errors
- Catastrophic-backtracking protection with a 1.5 s time budget
Benefits
- Build and debug patterns faster than trial and error in code
- Avoid patterns that hang on certain input
- Uses the same engine as your browser and Node.js
Frequently asked questions
Which regex flavour does this use?
It uses your browser’s JavaScript (ECMAScript) engine, so results match JavaScript and Node.js. Other languages such as PCRE or Python differ in some features.
Why was my pattern stopped?
Patterns like (a+)+ can take exponential time on some inputs. Matching runs in a worker and is stopped after 1.5 seconds so the page stays responsive.
Why does only one match appear?
Without the g (global) flag JavaScript returns only the first match. Turn on g to find them all.
Related tools
- JSON Formatter — Beautify or minify JSON with 2-space, 4-space or tab indents, sort keys and browse it as a collapsible tree.
- JSON Validator — Check JSON syntax as you type, see the exact line and column of any error and get warnings for duplicate keys.
- XML Formatter — Pretty-print or minify XML with comments, CDATA and DOCTYPE support, plus a well-formedness check with error positions.
- HTML Formatter — Beautify HTML with your choice of indentation and line wrapping, including inline <script> and <style> blocks.
- CSS Formatter — Beautify minified CSS into readable rules with custom indentation, brace style and one selector per line.
- JavaScript Formatter — Beautify JavaScript with configurable indentation, brace style and line wrapping to make minified code readable.