Regex Tester
Write and test regular expressions against sample text. See matches highlighted in real-time, view capture groups, and use the built-in regex reference.
A regular expression (regex) is a pattern used to match, search, or replace text. This tester highlights all matches in real-time and shows each capture group, making it easy to iterate on patterns before using them in production code.
Quick patterns:
Frequently Asked Questions
What regex flags are supported?
The tester supports all standard JavaScript regex flags: g (global), i (case insensitive), m (multiline), s (dotAll), and u (unicode).
How do I match a literal dot?
In regex, a bare dot (.) matches any character. To match a literal dot, escape it with a backslash: \. For example, to match 'file.txt' use file\.txt.
What is a capture group?
A capture group is a part of the regex wrapped in parentheses () that extracts a specific portion of the match. For example, (\d{4})-(\d{2})-(\d{2}) extracts the year, month, and day separately from a date string.
What is the difference between test() and match()?
test() returns true/false — useful for validation. match() returns the matched strings and capture groups — useful for extraction. This tool shows both the matches and the capture groups.