About Regex Tester
Regular expressions are compact and unforgiving: one misplaced backslash turns a pattern into a syntax error, and a pattern that behaves on a tiny example can do something unexpected on a real log file. This tester compiles the pattern with the JavaScript engine your browser actually uses, so flag behavior, capture groups and replacement rules match what your code will do.
Matches are highlighted in a read-only rendering and listed with their positions and numbered capture groups, which makes it easy to see why a greedy quantifier swallowed more than expected. An optional replacement field previews the output of a $1-style substitution, and the presets give you starting points for email addresses, URLs, phone numbers, dates and IP addresses.
What this tool does
Six flag toggles
Toggle g, i, m, s, u and y independently; the composed pattern shows exactly which flags will be compiled and copied.
Live highlighted matches
Matches are marked in a read-only rendering of the text as you type, and zero-length matches get a visible caret marker.
Positions and capture groups
Every match is listed with its number, start position, full text and each numbered capture group, including unmatched optional groups.
Replacement preview
Type a replacement using $1, $2 or $& references and see the rewritten text and the number of replacements before changing code.
Engine-accurate errors
An invalid pattern shows the browser's own RegExp message, which is the same explanation your runtime will give at execution time.
Pattern presets
Email, URL, phone, date and IP presets fill the pattern and sensible flags, giving you a working starting point rather than an empty box.
How to use Regex Tester
- 01
Pick a preset or type a pattern
Choose a common preset as a starting point, or write your own JavaScript pattern without the surrounding slashes.
- 02
Set the flags
Toggle g, i, m, s, u and y; the composed regex above the test text shows exactly what will be compiled.
- 03
Add the test text
Paste the text to search; matches are highlighted and listed as soon as the pattern and the text are both valid.
- 04
Inspect the matches
Read the match list for start positions and capture groups, and check the highlighted text to see what each part of the pattern consumed.
- 05
Preview a replacement
Type a replacement string with $1 or $& references to see the rewritten text and replacement count.
How this tool works
- Works with
- PATTERN → MATCHES
- Processing
- Client-side, in your browser. Nothing is uploaded.
- Requirements
- Chrome, Edge, Firefox or Safari · JavaScript enabled
Limitations worth knowing
- Only JavaScript regular expressions are tested; PCRE, Python and .NET-only syntax such as inline flags or possessive quantifiers is not supported.
- A single runaway match can still block the tab because matching is synchronous on the main thread; the caps limit long match lists, not pathological backtracking inside one match.
- Matches are capped at 1,000, test text at 100,000 characters, patterns at 2,000 characters and replacements at 10,000 characters.
- Zero-length matches are visible only as a thin caret marker in the highlighted preview because there is no character to highlight.
Privacy and file handling
The pattern, flags, test text and replacement are processed only in this browser tab by JavaScript and never uploaded, stored or logged. Reloading the page discards everything you entered, and no network request is made while matching.
Read the full privacy policy