Regex Tester
Test regular expressions against text and see matches highlighted in real time.
How to use
- 1Enter in format:
- 2Line 1: Regex pattern (e.g. \d+)
- 3Line 2: Flags (g, i, m, etc.) - optional
- 4Line 3: ---
- 5Lines 4+: Text to test
Frequently Asked Questions — Regex Tester
What regex flavors does this tool support?+
This tool uses the JavaScript RegExp engine. Most JavaScript regex syntax is compatible with Python (re), PCRE (PHP, Nginx), and Java regex, with minor differences in lookahead/lookbehind support.
What are regex flags?+
Flags modify how the pattern matches: g (global, find all matches), i (case-insensitive), m (multiline, ^ and $ match line boundaries), s (dot matches newlines).
What is the difference between .* and .*??+
.* is greedy — it matches as much as possible. .*? is lazy — it matches as little as possible. For example, matching HTML tags: <.*> matches the entire string, <.*?> matches each tag individually.
How do I match a literal dot?+
Escape it with a backslash: . The unescaped . matches any character except a newline. To match a period specifically, use .
What is a capture group?+
A capture group (parentheses) captures the matched text so it can be referenced later, e.g., (d{4}) captures a 4-digit year. Named groups use (?<name>...) syntax.
How do I match the start or end of a line?+
Use ^ to match the start of a line and $ to match the end. Enable the m (multiline) flag so they work per line, not just the full string.