Regex Tester
Test regular expressions with live match highlighting, match details, and preset patterns.
| # | Index | Matched Text | Length | Capture Groups |
|---|---|---|---|---|
| 1 | 14 | hello@joytools.dev | 18 | None |
| 2 | 36 | support@company.org | 19 | None |
How do I use Regex Tester?
Enter your regular expression pattern and toggle flags (`g`, `i`, `m`, `s`, `u`), or click a Quick Pattern preset.
Paste your test string into the Test String editor to view real-time highlighted matches and capture groups.
Inspect the Match Details list (indices and `$1`, `$2` groups) or switch to Find & Replace mode.
What features does Regex Tester offer?
Real-time regex match highlighting & capture group index table
Support for flags (g, i, m, s, u, y)
Common developer pattern presets (Email, URL, IP, Date)
100% client-side JavaScript RegExp evaluation
ECMAScript `RegExp` Flags, Quantifiers & Catastrophic Backtracking (ReDoS)
This tester executes native V8/SpiderMonkey ECMAScript `RegExp` syntax directly in your browser, supporting named capture groups (`(?<name>...)`), lookaheads (`(?=...)`), and lookbehinds (`(?<=...)`).
| Flag | Name | Engine Behavior Modification | Common Pitfall Without Flag |
|---|---|---|---|
| g | Global | Finds all matches rather than stopping after index 0 | .match() returns only the first occurrence |
| i | Ignore Case | Case-insensitive matching ([a-z] matches A-Z) | Fails on uppercase email/URL characters |
| m | Multiline | ^ and $ match start/end of each line (\n) instead of whole string | ^ only matches index 0 of multi-line log |
| s / u | DotAll / Unicode | . matches \n (s); enables surrogate-pair & \p{...} matching (u) | . stops at line breaks; emojis split in half |
Frequently Asked Questions about Regex Tester
What is Catastrophic Backtracking (ReDoS) and why do nested quantifiers like `(a+)+$` freeze regex engines?
NFA regex engines evaluate ambiguous nested quantifiers like `(a+)+$` or `([a-zA-Z]+)*` in $O(2^n)$ exponential time when a string fails to match at the final character. Flatten nested quantifiers to `a+$` or use possessive/atomic patterns to keep matching linear.
Why does `^` or `$` only match the very start and end of my multi-line text?
By default, `^` and `$` anchor to the beginning and end of the entire string buffer. Enable the `m` (Multiline) flag so `^` and `$` match immediately after and before every `\n` line break.
How do I change a greedy quantifier (`.*`) into a lazy (non-greedy) quantifier (`.*?`)?
Append a question mark `?` after any quantifier (`*?`, `+?`, `??`, `{n,m}?`). For example, `/<.+>/` greedily matches from the first `<` to the very last `>` on a line, whereas `/<.+?>/` stops at the first closing `>`.
Why do I need the `u` (Unicode) flag when matching emojis or `p{L}` character classes?
Without the `u` flag, JavaScript `RegExp` treats 4-byte UTF-16 astral symbols (like emojis) as two separate 2-byte surrogate code units and does not recognize Unicode property escapes like `\p{L}` or `\p{Emoji}`.
Explore Related Developer Tools
XML Formatter
Format, validate, and minify XML documents. Powered by xml-formatter for robust processing.
.env File Editor
Visual editor for .env files — parse, validate, detect duplicate keys, mask secrets, and generate .env.example templates for Next.js, Django, Laravel, Rails, and more.
cURL to Code Converter
Convert cURL commands into JavaScript (Fetch, Axios), Python (requests, httpx), Go, Rust, and PHP code.
cURL to JavaScript Fetch Converter
Transform cURL commands into modern JavaScript and Node.js 20+ Fetch API calls with typed headers and JSON.stringify payloads.
cURL to Axios Request Converter
Convert cURL commands into Axios request config objects (method, url, headers, data) for Node.js and TypeScript projects.
HTML to React JSX
Transform raw HTML snippets into valid React JSX/TSX components. Auto-converts class to className and style objects.