Regex Tester
Test regular expressions in real-time
/ / g
Common patterns
Free online regex tester — JavaScript flavor, live highlighting
Toololis Regex Tester lets you test regular expressions against sample text with live match highlighting. Supports all 5 JavaScript regex flags (g, i, m, s, u), named groups, and capture groups. Everything runs in your browser — patterns and test text never leave your device.
Regex flag cheatsheet
- g (global) — Find all matches, not just the first
- i (ignoreCase) — Match regardless of upper/lowercase
- m (multiline) —
^and$match line boundaries, not just string boundaries - s (dotAll) —
.matches newlines too - u (unicode) — Enables
\p{...}unicode classes and surrogate pair handling
How to use this tool
- 1
Type your regex pattern
Enter a regular expression in the pattern field. No leading/trailing slashes needed — just the pattern itself.
- 2
Toggle flags
Click flag chips to enable g (global), i (case-insensitive), m (multiline), s (dotall), or u (unicode). Combinations work.
- 3
Paste test text
Drop the text you want to match against. Matches are highlighted live as you type.
- 4
Review matches
See the match count, individual match strings, and captured groups. Invalid regex shows a clear error message.
Common regex patterns
- Email:
\b[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}\b - URL:
https?://[^\s]+ - ISO date:
\b\d{4}-\d{2}-\d{2}\b - IPv4:
\b(?:\d{1,3}\.){3}\d{1,3}\b - Hex color:
#[0-9a-fA-F]{3,6}\b - Phone E.164:
\+?[1-9]\d{1,14}
Regex anchors & groups — quick reference
^/$— Start / end of string (or line with m flag)\\b/\\B— Word boundary / non-boundary()— Capture group(?:...)— Non-capture group (faster, no backref)(?<name>...)— Named capture group(?=...)— Positive lookahead(?!...)— Negative lookahead(?<=...)— Positive lookbehind(?<!...)— Negative lookbehind
Frequently Asked Questions
What regex flavor does this support?
JavaScript's native
RegExp engine, which is close to PCRE but not identical. Lookbehinds (?<=...), named groups (?<name>), and unicode classes \p{...} all work.What does the g flag do?
g (global) finds all matches in the text instead of stopping at the first one. Without g,
match() returns only the first match. This tool enables g by default for better visibility.What is the difference between g and m?
g = global (find all matches). m = multiline (make
^ and $ match line starts/ends instead of just string start/end). They are independent — use both when searching line-by-line across a multi-line string.How do I match across newlines?
Use the s (dotall) flag. By default,
. matches any character except newlines. With s, . also matches newlines — useful for parsing HTML or multi-line blocks.Is my regex data private?
Yes. Testing runs in your browser using native
RegExp. No patterns or test text are logged, transmitted, or stored.Why is my regex slow?
Catastrophic backtracking. Patterns like
(a+)+ or (.*)* can explode in time on long inputs. Use atomic groups or possessive quantifiers (not supported in JS — rewrite the pattern) or simpler expressions.Can I use capture groups?
Yes. Parenthesized groups
(foo) capture text. Access them in JavaScript via match[1], match[2], etc. Named groups (?<name>foo) are accessed via match.groups.name.You might also like
🔒
100% Privacy. This tool runs entirely in your browser. Your data is never uploaded to any server.