Regex Tester and Debugger
Regular Expression
Test String
Match Details
No matches yet
Enter a regex and test string
Real-time Matching
See matches instantly as you type. Visual highlighting shows exactly what your regex captures.
Runs in Your Browser
All processing happens in your browser. Nothing is uploaded for processing; your pattern is saved in the page URL, while the test text goes into a link only when you click Share.
Learn Regex
Built-in explanations break down each token. Quick recipes for common patterns.
About the Regex Tester
The Regex Tester evaluates JavaScript regular expressions against test input in real time — capture groups highlighted, match indices reported, pattern explanation and code export alongside. The engine is the same one that ships with V8 and SpiderMonkey, so behavior matches what your `String.prototype.match` and `RegExp.prototype.exec` will do in production. Flags `g`, `i`, and `m` are toggleable; named capture groups and lookbehind work as defined in the ECMAScript specification. Matching runs client-side — the tester never proxies through a server — but your pattern is saved in the page address, so avoid putting live secrets in it. The test string goes into a link only when you click Share.
Updated: May 8, 2026
Related Tools
How to use the regex tester
- Paste your regex pattern into the pattern field (without surrounding slashes — the input is treated as the body).
- Toggle flags as needed: `g` (global, find all — on by default), `i` (case-insensitive), `m` (multiline — `^`/`$` anchor to line boundaries).
- Paste your test string. Matches highlight inline; the match table lists each match with its position and the value of every capture group.
- Read the pattern explanation to see what each token does, or start from a built-in recipe (email, URL, phone, date, IPv4, and more). The code export tab produces the same pattern for JavaScript, Python, PHP, Go, and Rust.
- The position column reports the start and end character offsets (UTF-16 code units) of each match — useful when porting a pattern to a tool that takes an index input (e.g., a logging pipeline or a code-mod). Note that for strings containing non-BMP characters (like most emoji), the index counts code units, not codepoints.
Common use cases
- Log parsing. Build a pattern that extracts the timestamp, level, and message from your application log format, then export the regex into a logging pipeline (Vector, Fluent Bit, Logstash) or a one-liner `awk` / `sed` command.
- Input validation. Email, URL, phone, postal code, IBAN, credit-card patterns — test edge cases (empty strings, unicode names, IDN domains) before shipping the pattern to production validation.
- Find-and-replace prep. Iterate on a `s/foo/bar/g` style replacement against representative input until the result matches expectations, then run the same replacement in your editor or with `sed`.
- Data extraction. Pull semver versions from a changelog, scrape JIRA ticket IDs from commit messages, or harvest URLs from a markdown document. Named capture groups make the resulting code self-documenting.
- Learning regex. The explanation panel breaks your pattern into tokens and describes each one, so you can see how character classes, quantifiers, anchors, and groups interact.
Privacy and security
The regex engine is whatever the browser ships — V8 in Chrome, JavaScriptCore in Safari, SpiderMonkey in Firefox. Nothing is sent to our servers or analytics; the pattern runs against the test string inside your browser. The pattern and flags are saved in the page address as you type, though, so they are sent to our CDN when you reload and kept in browser history. Scripts on the page, including ads, can read them, and ad requests may send the page address to Google. The test string is not written to the address bar; it goes into a link only when you click Share. Avoid putting live secrets or PII in the pattern, and in test strings you share. Patterns that exhibit catastrophic backtracking will block the main thread of the tester (just like they would in production), so test pathological inputs against your own runtime before deploying — the browser tab will hang on truly degenerate cases until you close it. A shared link stays in the recipient's browser history and in any app the link passes through.
Tips and pitfalls
- Catastrophic backtracking. Patterns like `(a+)+$` or `(a|aa)+` against long input run in exponential time. The 2016 Stack Overflow outage and the 2019 Cloudflare regex outage were both caused by this. Use atomic groups (Go RE2 / .NET) or restructure to avoid nested unbounded quantifiers.
- `.` does not match newline. Set the `s` flag (dotall) when you want `.` to span line boundaries.
- Lookbehind support is recent. Variable-length lookbehind landed in ECMAScript 2018 and works in all modern browsers, but older runtimes (Node 8 and below, IE) reject the pattern at parse time.
- Unicode property escapes need `u`. `\p{Letter}`, `\p{Emoji}`, and similar escapes only work when the `u` flag is set. This tester toggles only `g`, `i`, and `m`, so test those patterns in your own runtime.
- V8 vs RE2 vs PCRE. JavaScript regex is backtracking; Go RE2 is linear-time but lacks backreferences and lookbehind; PCRE is the superset most other tools (perl, grep -P, PHP) use. Patterns that pass here may need tweaks for those engines.
Frequently Asked Questions
- Which regex flavor does this tester use?
- JavaScript / ECMAScript regex, evaluated by your browser engine. That means full support for capture groups, named captures (`(?<name>...)`), and lookbehind (Unicode property escapes need the `u` flag, which this tester does not offer), but no atomic groups or possessive quantifiers (those exist in Java, .NET, and PCRE but not in ECMAScript).
- What is catastrophic backtracking?
- A regex that takes exponential time on certain inputs because the engine tries every possible match path. Classic patterns: nested unbounded quantifiers like `(a+)+`, alternations with overlap like `(a|aa)+`. The fix is to make the pattern unambiguous — use possessive quantifiers (in PCRE), atomic groups (in .NET / Go RE2), or restructure so each character has only one matching path.
- Are lookbehind and lookahead supported?
- Yes — both lookbehind (`(?<=...)`, `(?<!...)`) and lookahead (`(?=...)`, `(?!...)`). Variable-length lookbehind landed in ECMAScript 2018 and is supported in every browser shipped after 2019.
- How do I match Unicode characters?
- Set the `u` flag and use Unicode property escapes: `\p{Letter}` (any letter), `\p{Number}` (any number), `\p{Script=Hangul}` (specific script). Without `u`, `\p{...}` does not work and `.` does not match astral-plane characters (above U+FFFF) correctly. This tester offers only the `g`, `i`, and `m` flags, so check `u`-flag patterns in your own runtime.
- Greedy vs lazy quantifiers — what is the difference?
- `*`, `+`, `?`, and `{n,m}` are greedy by default (they try to match as much as possible, then backtrack). Append `?` to make them lazy (match as little as possible, then expand): `.*?` matches the shortest possible string, `.+?` matches one-or-more lazily. Lazy quantifiers are essential when extracting text between delimiters.
- How do named capture groups work?
- `(?<name>...)` defines a named capture; `\k<name>` backreferences it within the pattern; `$<name>` references it in a replacement template. Named groups make patterns self-documenting and survive refactors better than positional indices.
- When should I NOT use regex?
- When the input has nested or recursive structure — HTML, JSON, source code, paired delimiters. Use a real parser instead (DOMParser, JSON.parse, an AST library). The famous "do not parse HTML with regex" answer on Stack Overflow remains correct: regex describes regular languages, and HTML is not regular.
- Any tips for performance?
- Anchor your pattern with `^` or `\b` when possible to fail-fast on non-matches. Make alternations unambiguous so the engine never backtracks. Pre-compile patterns by storing them in a `RegExp` instance instead of recreating them in a hot loop. Profile in production with realistic input — a pattern that runs fast on test data may still be O(n²) on real input.
- How does this differ from Go RE2 or PCRE?
- JavaScript regex is a backtracking engine — it supports backreferences, lookbehind, and arbitrary lookaround at the cost of worst-case exponential runtime. Go RE2 is a finite-automaton engine — linear time guaranteed, but no backreferences or lookbehind. PCRE is a backtracking superset of JavaScript regex with extras like atomic groups and recursive patterns. Test patterns in the engine they will run in.