Prefer precise character classes
A narrow class like [0-9]{4}-[0-9]{2} backtracks far less than .* with lookarounds. Say exactly what you accept and the engine does less guessing.
Test, visualize, and export regular expressions. Everything runs locally — nothing is sent.
Choosing a preset fills the pattern, flags, and a sample test string instantly.
Privacy-First: Matching runs 100% in your browser with zero server transmission. Patterns and samples never leave this tab.
Highlight preview (hover a match for its index)
Match groups inspector
| # | Index | Full match | Groups |
|---|
Code export
Workflow
Regex bugs hide in plain sight — one greedy quantifier and a validator accepts garbage. The loop is always the same: express the intent, run it against hostile samples, read the group breakdown, then export the proven pattern into real code.
Write the expression between the slashes, toggle g / i / m / s / u, or jump-start from a preset — Email, IPv4, UUID, and four more ship with sample text.
Drop logs, form input, or pasted payloads into the editor. Matches highlight live in alternating colors with their index on hover.
The summary shows match count and scan time; the table breaks every match into full text, numbered groups, and named groups.
Copy the same logic as JavaScript matchAll, Python re.finditer, or PHP preg_match_all and paste it straight into your project.
Reference
Flags change what the same pattern means. Global finds every occurrence, case-insensitive forgives casing, multiline re-anchors per line, dotAll lets dots span newlines, and unicode fixes character counting beyond ASCII.
| Flag | Name | What it does |
|---|---|---|
| g | Global | Find all matches, not just the first. The preview always scans globally. |
| i | Case-Insensitive | Match upper and lower case alike — handy for emails and URLs. |
| m | Multiline | Makes ^ and $ anchor per line, so validators test every row. |
| s | DotAll | Lets . match line breaks for multi-line blocks and payloads. |
| u | Unicode | Correct code-point handling for emoji and international text. |
Safety
ReDoS — catastrophic backtracking — turns one crafted input into a hung server. These three habits keep patterns linear-time, and the guard on this page enforces the same budgets you should enforce in production.
A narrow class like [0-9]{4}-[0-9]{2} backtracks far less than .* with lookarounds. Say exactly what you accept and the engine does less guessing.
(a+)+ or (x|x y)* on overlapping input causes catastrophic backtracking. Flatten the group or add an atomic boundary to kill the ambiguity.
^...$ plus explicit limits ({1,64} instead of +) shrink the search space dramatically — the 150 ms guard on this page rarely trips on anchored patterns.
FAQ
No. Matching, highlighting, timing, and code generation all run locally in your browser tab with the built-in JavaScript RegExp engine — the network tab stays completely silent. Your last pattern, flags, and test string are remembered only in your own browser localStorage under the key regex:state so you can resume after a reload.
This page guards against that: test input is capped at 20,000 characters, scanning stops after 500 matches or a 150 ms time budget, and only the first 50 matches render in the table. If a pattern hits a guard you get a warning instead of a hang — simplify nested quantifiers like (a+)+ to recover instantly.
Yes for JavaScript — this tool uses your browser native RegExp engine, the exact engine Node.js and frontend code run. The Python and PHP snippets translate the same logic to re.finditer and preg_match_all, but re-test edge cases (Unicode classes, lookbehind) in those runtimes before shipping.