Regex Tester & Debugger
Test, debug & build JavaScript regular expressions in real time. Live highlighting, capture groups, replace, split, explain, performance benchmarks, 20+ presets & cheat sheet.
📖 Regex Cheat Sheet — quick reference
Character classes
. any char (except newline)\d digit · \D non-digit\w word char · \W non-word\s whitespace · \S non-ws[abc] any of a, b, c[^abc] NOT a, b, c[a-z] rangeQuantifiers
* 0 or more+ 1 or more? 0 or 1{n} exactly n{n,} n or more{n,m} n to m*?, +? lazy (non-greedy)Anchors & boundaries
^ start of string/line$ end of string/line\b word boundary\B non-word boundary\A start of string\Z end of stringGroups & alternation
(abc) capture group(?:abc) non-capturing(?<name>abc) named groupa|b a or b\1, \2 back-reference$1, $2 in replaceLookarounds
(?=abc) positive lookahead(?!abc) negative lookahead(?<=abc) positive lookbehind(?<!abc) negative lookbehindFlags
g global (all matches)i case-insensitivem multilines dotall (. matches \n)u unicodey stickyHow to Use the Regex Tester
- Type or paste a regular expression in the pattern field (no slashes needed — they're shown automatically).
- Toggle flags (g, i, m, s, u, y) using the checkboxes or type them in the flags box.
- Paste your test string below — matches highlight live as you type.
- Pick a mode: Match (find), Replace (substitute), Split, Explain, or Benchmark.
- Inspect capture groups, named groups, indices & full match details in the table below.
- Pick from 20+ presets (email, URL, phone, UUID, dates, IPs & more), copy results, or export as JSON/CSV.
What is a Regular Expression?
A regular expression (regex or regexp) is a pattern that describes a set of strings — used for searching, validating, extracting, replacing and splitting text. They're built into virtually every programming language and text editor.
This tool uses the JavaScript ECMAScript regex engine running natively in your browser, so behaviour is identical to RegExp in Node.js, V8, JavaScriptCore and SpiderMonkey. Patterns built here work the same in your JS/TS code. For PCRE/POSIX engines (PHP, Python, Java, Go), most syntax overlaps but a few features differ — see the cheat sheet.
Everything runs 100% client-side. Your patterns and test data never leave your device.
Common Use Cases
Why Choose Our Regex Tester?
Frequently Asked Questions
Which regex flavor does this tool use?
JavaScript / ECMAScript regex — the same engine that runs in browsers and Node.js. About 90% of syntax overlaps with Python, PHP/PCRE, Java, Go, Ruby, Perl. Differences: JS lacks possessive quantifiers (*+, ++) and atomic groups ((?>…)), but supports lookbehind, named groups (?<name>) and unicode property escapes.
What is "catastrophic backtracking"?
When a regex engine takes exponential time to fail-match certain inputs. Common cause: nested quantifiers like (a+)+ against input like aaaaaab. Use Benchmark mode — anything over ~100ms on a small test string is suspect.
Why doesn't my (?<=...) lookbehind work?
Lookbehind landed in ES2018. All modern browsers (Chrome 62+, Firefox 78+, Safari 16.4+) support it. If you're targeting older browsers, transpile or use a workaround with capture groups.
How do I match across line breaks?
Enable the s (dotall) flag — then . matches newlines too. Alternatively use [\s\S] or [^].
Can I use this regex in PHP / Python / Java?
Mostly yes — JS regex is a subset of PCRE. Watch out for: PHP requires delimiters (/pattern/flags), Python uses re.compile(r"pattern"), Java needs double-escaped backslashes (\\d instead of \d).
What's the difference between greedy and lazy quantifiers?
Greedy (*, +, {n,m}) matches as much as possible. Lazy (*?, +?, {n,m}?) matches as little as possible. Example on "<b>hi</b>": <.+> greedy matches the whole string; <.+?> lazy matches just <b>.
How do I reference capture groups in the replacement?
Use $1, $2, etc. for numbered groups; $<name> for named groups; $& for the whole match; $$ for a literal dollar sign.
Is my data sent anywhere?
No. Patterns and test strings are processed entirely in your browser using the native RegExp API. Nothing is uploaded.
