Regex Tester
Test regular expressions against sample text with live match highlighting and group capture display.
Flags
Results are for general guidance only — not professional advice. Learn more.
How to use this tool
Enter your regular expression in the Pattern field and your test string below. The tool updates in real time, showing the number of matches, a highlighted version of the test string with all matches marked, and a detailed list of each match with its index and any capture groups.
Use the flag checkboxes to toggle global, case-insensitive, multiline, and dotAll modes. If the pattern is invalid, an error message will appear.
Thanks for helping us improve this tool. 🙏
Frequently asked questions
What is a regular expression?
A regular expression (regex or regexp) is a sequence of characters that defines a search pattern. They are used for string searching and manipulation — to find, replace, or validate text. For example, the pattern \d+ matches one or more digits.
What do regex flags do?
Flags modify how the pattern is applied. The most common are: g (global) — find all matches; i (case-insensitive) — match regardless of letter case; m (multiline) — make ^ and $ match line boundaries; s (dotAll) — make the dot (.) match newlines.
How do I match all occurrences?
Add the g (global) flag to your regex. Without it, the regex engine stops after the first match. With the g flag, it continues through the entire string and returns all matches.
What is a capture group?
A capture group is a part of a regex enclosed in parentheses ( ) that captures a portion of the match. For example, (\d{4})-(\d{2})-(\d{2}) matches a date and captures the year, month, and day as separate groups. Named capture groups use (?<name>...) syntax.