Regex Tester

Test regular expressions against text in real time — highlight matches, show groups, and inspect results with detailed output.

/ /
Matches: 0 Groups: 0

📚 Common Patterns

About the Regex Tester

Regular expressions (regex or regexp) are sequences of characters that define a search pattern. They are one of the most powerful and widely used tools in programming — used for input validation, text parsing, data extraction, search and replace operations, and lexical analysis in compilers and interpreters.

This regex tester provides real-time match highlighting as you type, showing exactly which parts of your test string match the pattern. It displays the total match count, capturing group count, and detailed match information including the matched text, position (index), and the value of each capturing group.

The flag toggles let you quickly enable global (g — find all matches, not just the first), case-insensitive (i), multiline (m — ^ and $ match line boundaries), dotAll (s — dot matches newlines), and Unicode (u — enables full Unicode support) modes. The pattern library provides ready-to-use patterns for the most common regex use cases.

All processing happens in your browser using the JavaScript RegExp engine. This means the regex syntax and behavior matches JavaScript exactly — useful for web developers writing client-side validation or Node.js server-side code.

Frequently Asked Questions

What regex flavor does this use?
This tester uses JavaScript's built-in RegExp engine. JavaScript regex is largely compatible with PCRE (Perl-Compatible Regular Expressions) used in PHP, Python, Ruby, and most other languages, but has some differences — notably, JavaScript doesn't support lookbehind in older browsers, POSIX character classes, or some advanced features.
What does the 'g' flag do?
The global (g) flag makes the regex find all matches in the string instead of stopping after the first match. Without it, only the first occurrence is matched. Always use 'g' when you need to count, highlight, or replace all occurrences.
What are capturing groups?
Capturing groups are parts of a regex pattern wrapped in parentheses, e.g., (\d{4})-(\d{2})-(\d{2}). They "capture" the matched text for each group, making it available separately. In a date pattern, group 1 might capture the year, group 2 the month, and group 3 the day.
Why does my regex work in Python/PHP but not here?
Different regex engines have slightly different syntax. Common differences: Python uses (?P<name>) for named groups while JavaScript uses (?<name>), PHP/PCRE supports \A and \Z anchors while JavaScript doesn't, and some lookahead/lookbehind syntax differs. Check the Regex Cheatsheet for cross-language comparison.