Regex Tester
Test regular expressions with live matching
What is Regex Tester?
Regex Tester lets you write and test regular expressions against sample text in real time. It highlights all matches, shows capture groups, and reports the total match count. Regular expressions are patterns used to search, match, and manipulate text in virtually every programming language.
How to Use
- Enter your regex pattern and set flags (g for global, i for case-insensitive, m for multiline).
- Type or paste your test string in the text area below.
- Matches are highlighted instantly, and capture groups are displayed in a separate section.
Frequently Asked Questions
What do the regex flags mean?
g (global) finds all matches instead of stopping at the first. i (case-insensitive) ignores letter casing. m (multiline) makes ^ and $ match the start and end of each line, not just the entire string. You can combine flags-for example, "gi" finds all matches regardless of case. The s (dotAll) flag makes the dot character match newlines as well.
What are capture groups?
Parentheses () in a regex create capture groups that extract specific parts of a match. For example, (\d3)-(\d4) matching "555-1234" captures "555" and "1234" separately. Named capture groups like (?<area>\d3) make extracted values easier to reference in code. Use non-capturing groups (?:...) when you need grouping without extraction.
What are some commonly used regex patterns?
Email: [\w.-]+@[\w.-]+\.\w+. Phone: \d{3}[-.] ?\d{3}[-.]?\d{4}. URL: https?://\S+. These are simplified patterns-production use often requires more thorough validation. For dates, try \d{4}-\d{2}-\d{2} (ISO format). For IP addresses, use \d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}. Always test edge cases before deploying regex patterns to production.
