π Regex Tester
Write a regular expression and test it against your input in real time. Matches are highlighted and all match positions are listed.
How to Use the Regex Tester
The Regex Tester lets you build, test, and debug regular expressions in real time with live match highlighting. Enter your regex pattern in the Pattern field β you don't need to include the leading and trailing slashes. Enter the flags you want to apply in the Flags field (common flags: g for global to find all matches, i for case-insensitive, m for multiline). Then type or paste your test string in the text area below.
Matches update instantly as you type. The Highlighted Matches box shows your test string with all matches highlighted in yellow. The Match List shows each match with its captured text and index position in the string. A green status badge shows how many matches were found, and a red badge appears if your pattern has a syntax error. This tool is useful for validating email addresses, parsing log files, extracting data from text, validating input formats, and learning regex syntax. All matching runs client-side using the browser's native JavaScript regex engine.
Frequently Asked Questions
What is a regular expression (regex)?
βΊ
A regular expression (regex or regexp) is a sequence of characters that defines a search pattern. It is used in programming and text processing to find, match, and manipulate strings. For example, the pattern \b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b with the i flag matches email addresses. Regex is supported in virtually every programming language.
What are regex flags?
βΊ
Regex flags modify how the pattern is applied. The most common flags are: g (global) β find all matches instead of stopping after the first; i (case-insensitive) β treat uppercase and lowercase letters as equivalent; m (multiline) β make ^ and $ match the start and end of each line instead of the whole string; s (dotAll) β make the . metacharacter match newlines as well.
How do I match a literal dot or other special character?
βΊ
In regex, the dot (.) is a metacharacter that matches any character except newline. To match a literal dot, escape it with a backslash: \. Similarly, to match literal parentheses, brackets, or other special characters (+, *, ?, ^, $, {, }, [, ], |, \, /), prefix them with a backslash.
What is the difference between greedy and lazy matching?
βΊ
By default, regex quantifiers are greedy β they match as many characters as possible. For example, .* in "abc def" matches the entire string. Adding ? makes a quantifier lazy (non-greedy), matching as few characters as possible: .*? would match as little as possible. Lazy matching is useful when you want to capture the shortest possible match, such as extracting individual HTML tags.