mockstack. 0 matches

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

Pattern
/
Test Text
Matches
Current Pattern
Ready Also on the menuCron Expression BuilderTime ConverterColor Palette Generator

About the Regex Tester

Updated

Tests regular expressions live, in your browser. 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 $ match at the start and end of each line. 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. Choosing one 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, so a stray space is visible. 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.
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 only 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
Remembers your split. Double-click the bar to reset it. By default the text pane takes the extra width and Matches keeps 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.