Developer Tools
Regex Tester
Write a regular expression and see every match highlighted as you type. Toggle flags, inspect capture groups and named groups, start from common examples, and copy or download the results.
Runs in your browser
Features
What you get
Live highlighting
Matches are highlighted in your text as you type, with alternating colours so neighbours are easy to tell apart.
All JavaScript flags
Global, ignore case, multiline, dot-all, unicode and sticky — toggle them or type them.
Capture groups
Each match lists its position plus numbered and named groups, including groups that didn't take part.
Clear errors
Invalid patterns show the browser's error message instead of failing silently.
Freeze protection
Matching runs in a worker that stops after 1.5 seconds, so a runaway pattern can't lock up the page.
Examples and export
Ten starter patterns with explanations; copy the regex or matches, or download a TXT report.
How to use
How to use the Regex Tester
Your pattern and flags are passed to the browser's built-in RegExp, exactly as JavaScript code would use them. Matching runs in a separate Web Worker so the page stays responsive; if a pattern takes longer than 1.5 seconds — usually catastrophic backtracking from nested quantifiers like (a+)+ — the worker is stopped and you're told why. Zero-length matches advance one character so a global search always finishes. The pattern is never evaluated as code.
- 01
Enter a pattern
Type a regular expression between the slashes and pick flags — or load an example.
- 02
Add test text
Paste the text to search. Matches highlight instantly and appear in the list.
- 03
Inspect and copy
Check positions and groups, then copy the regex, copy the matches or download the report.
Examples
Worked examples
Indian PIN codes
\b[1-9]\d{2}\s?\d{3}\b with the g flag finds 560001 and 400 013 but not 012345.
Dates with named groups
(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2}) on “Due 2026-11-12” gives year 2026, month 11, day 12.
Why the g flag matters
\d+ on “10 apples, 20 pears” finds only 10 without g, and both 10 and 20 with it.
Technical specifications
- Engine
- Your browser's JavaScript RegExp
- Flags
- g, i, m, s, u, y
- Time limit
- 1.5 seconds per run
- Test text limit
- 200,000 characters
- Match limit
- 5,000 matches (first 2,000 highlighted)
- Export
- TXT report
Privacy
Patterns and text are matched in your browser and never sent or stored.
Read the full privacy policy.
FAQ
Regex Tester questions
A regex tester lets you try a regular expression — a pattern for finding text — against sample text before you use it in code. ZSpace Tools' Regex Tester uses JavaScript's own regex engine, highlights every match, lists each match's position and capture groups, and explains what went wrong when a pattern is invalid.
Your pattern and flags are passed to the browser's built-in RegExp, exactly as JavaScript code would use them. Matching runs in a separate Web Worker so the page stays responsive; if a pattern takes longer than 1.5 seconds — usually catastrophic backtracking from nested quantifiers like (a+)+ — the worker is stopped and you're told why. Zero-length matches advance one character so a global search always finishes. The pattern is never evaluated as code.
JavaScript (ECMAScript), via your browser's built-in RegExp. Most syntax is shared with PCRE, Python and Java, but some features differ — for example possessive quantifiers and some inline modifiers aren't supported in JavaScript.
Without the g (global) flag, JavaScript stops after the first match. Turn on Global to find them all.
The pattern took too long, usually because nested or overlapping quantifiers like (a+)+ or (.*)* make the engine try a huge number of combinations. Make the pattern more specific.
Groups written as (?<name>…). They capture like normal groups but can be referred to by name; the match list shows the name next to the value.
No. They're practical starting points — for instance, the email pattern accepts common addresses but not every address the standards allow. Test them against your own data.
No. Everything runs in your browser.
Related tools
JSON Formatter & Validator
Beautify, minify and validate JSON, with exact line and column for every error.
URL Encoder & Decoder
Percent-encode or decode URLs and query parameters, including Unicode and emoji.
HTML Formatter & Minifier
Beautify messy HTML with clean indentation, or minify it for production.