Regex Tester
Write, test, and debug regular expressions with real-time match highlighting. Enter a pattern and a test string and instantly see every match, capture group, and the result of a replacement.
No matches yet.
Quick reference
\ddigit\wword char\swhitespace.any char^start$end*0 or more+1 or more?optional{n,m}n to m[abc]set(…)group(?<name>…)named groupa|balternation\bword boundaryUse in code
const re = /pattern/g; const matches = str.match(re);
About the Regex Tester
Regular expressions are a compact language for matching patterns in text — validating emails, extracting fields from logs, or finding-and-replacing across a file. They are powerful but easy to get subtly wrong, which is why testing a pattern against real input before shipping it saves hours of debugging.
This tester uses the JavaScript (ECMAScript) regex engine, so patterns behave exactly as they will in Node.js and browser code. Capture groups and a live replacement preview make it easy to confirm not just what matches, but what you extract or rewrite.
How to use it
- 1Type your regular expression in the pattern field (the slashes are implied).
- 2Toggle the flags you need, such as g (global) or i (ignore case).
- 3Paste your test text below to see matches and groups highlighted live.
Features
- Live match highlighting as you type
- Numbered and named capture groups for each match
- Toggle flags: global, ignore-case, multiline, dotAll, unicode, sticky
- Live substitution preview with $1 / named-group replacements
Frequently asked questions
Which regex flavor does this use?
It uses the JavaScript (ECMAScript) engine, matching the behavior of regex in Node.js and the browser. Most syntax is shared with PCRE, but some advanced features differ.
What do the flags mean?
g matches all occurrences, i ignores case, m makes ^ and $ match line boundaries, s lets . match newlines, u enables full Unicode, and y (sticky) anchors matching at lastIndex.
Are my pattern and text private?
Yes. Matching runs entirely in your browser; nothing you type is sent anywhere.
How do capture groups work in replacement?
Reference numbered groups with $1, $2, … and named groups with $<name> in the replacement field to build the substituted output.