Regex Playground
Test JavaScript regular expressions with live highlights, capture groups, and replace preview.
What you can do
- Toggle flags
g,i,m,s,u,y - See all matches with index, line/column, and groups
- Preview replace with
$1,$&,$$, named groups - Use presets (email, URL, IPv4, dates, etc.)
Layout
Sidebar: pattern, flags, mode, replacement, presets, cheat sheet.
Test string editor with match highlights.
Bottom pane: match table or replace preview.
On narrow screens use Pattern, Test, and Results tabs.
Modes
| Mode | Shows |
|---|---|
| Match | Table of matches and capture groups |
| Replace | Full string after replacement |
Without g, only the first match is listed/replaced.
Toolbar
| Action | Effect |
|---|---|
| Sample | Loads email preset + primer text |
| Paste | Replaces test string from clipboard |
| Clear | Clears pattern, test, replacement |
| Copy result | Replace mode only |
Tips
Debug exec() behavior: Turn off g for single-match debugging.
Multiline logs: Enable m when testing ^ / $ per line.
Dedupe by capture: Copy a pattern into Remove Duplicates (Custom regex mode).
Keep in mind
JavaScript regex only — not PCRE or Python syntax. Very large test strings with complex patterns may be slow.
App shortcuts
| Action | Shortcut |
|---|---|
| Search tools | ⌘ K |
| Close current tab | ⌘⌥E (Ctrl+Alt+E on Windows) |
Note: ⌘W closes the browser tab. ⌘⇧E focuses the Explorer in Cursor/VS Code. Use ⌘⌥E (Ctrl+Alt+E) to close the current tool tab (click inside the app first so the IDE does not steal the shortcut).