mockstack.

Regex Tester

0 MATCHES ← Developer & Data

Matches highlight as you type, with a cheat sheet to learn from.

Pattern
/
Test Text
Matches
Current Pattern
READY PATTERN SAVED TO URL · SHARE THE LINK RUNS LOCALLY

About the Regex Tester

Tests regular expressions live, in your browser: settings in the left rail, the pattern and panes in the center, the cheat sheet a click away. A runaway pattern cannot freeze the page; matching runs in the background under a time limit and gets stopped with an explanation instead of a locked tab.

Every Setting

Flavor
The dialect pills in the rail: the same pattern checked against the JavaScript, PCRE and RE2 rule sets, because a pattern that works in one can fail in another.
Flags
Each one adds its letter to the box after the pattern. Global (g) finds every match instead of stopping at the first. Ignore Case (i) treats A and a as the same. Multiline (m) makes ^ and $ anchor to each line, not just the whole text. Dot All (s) lets the dot cross line breaks. Unicode (u) handles emoji and other multi-byte characters correctly.
Mode
Matches lists everything the pattern finds. Replace runs a substitution and shows the rewritten text; in the With box, $1 inserts the first (parentheses) group, $2 the second, and so on.
Presets
Working patterns for the everyday jobs: email, URL, IPv4, dates, phone numbers and more. Each loads with sample text that exercises it.
Recent
Your last eight patterns, kept in this browser. One click restores the pattern and its flags; Clear wipes the list.
Pattern
The expression itself, with Copy Pattern and Clear beside it. Spaces inside the pattern render as gold dots, because an invisible space is the classic broken-regex mystery. The small box after the slash holds the active flag letters.
Test Text
The text the pattern runs against, with every match highlighted in place as you type on either side. Open loads a log or text file, or drop one on the box.
Matches
One row per match: the matched text, then its character positions in the test text (9 TO 25 means it starts at character 9 and ends before 25). Below that, what each group captured: $1, $2 and so on are the pattern’s (parentheses) in order, and (?<year>…) style groups show their chosen name. So “year = 2026” means the group named year captured 2026.
Export
Copy Matches and Download, above the matches, take everything the pattern found, up to 10,000 matches. Whole Matches exports the matched text; Groups Only exports just what the (parentheses) captured. List puts one per line, with groups separated by tabs; CSV adds a header row and positions; JSON gives each match with its groups by number and name. Unique Only drops repeats, for pulling the distinct IP addresses or IDs out of a log.
Pane Divider
Drag the bar between Test Text and Matches to deal the width; it remembers your split, and double-clicking resets it. Left alone, the text pane takes the extra room and Matches holds a readable width.
Current Pattern
Under Matches on the right: the pattern taken apart piece by piece, each token described in plain language. Matches and Current Pattern scroll independently when they get long.
Cheat Sheet
The syntax reference in the drawer; click any entry to insert it into the pattern.

Common Questions

What is catastrophic backtracking?
A pattern shape that makes the engine try exponentially many paths. Here it gets killed after a second and named, instead of freezing the tab.
Can I share a pattern?
Yes. The link carries the pattern, flags and test text.
How do I pull every email address out of a file?
Load the Email preset, open the file, turn on Unique Only, and use Copy Matches or Download.

Related: Regex Flavors, Compared, JSON Formatter.