Regex Tester & Debugger
Test and debug regular expressions online for free with real-time match highlighting, replace preview, and a library of common regex patterns. Everything runs in your browser.
/
/
Test Text
Enter a regex and test text to see matches
Enter a regex to see an explanation
How to Use
- Enter your regular expression in the pattern field above.
- Toggle flags (g, i, m, s, u) as needed.
- Type or paste your test text — matches highlight in real time.
- Switch to Replace mode to test substitutions.
- Browse the Regex Library for common pattern templates.
FAQ
A regular expression is a sequence of characters that defines a search pattern. It is used for string matching, searching, and text manipulation. In JavaScript, regex is created with /pattern/flags syntax or the RegExp constructor.
A simple email regex is
^[^\s@]+@[^\s@]+\.[^\s@]+$. This matches strings with a local part, @ symbol, and domain. For production use, consider more comprehensive patterns or use a validation library.g (global) finds all matches, not just the first. i (case insensitive) ignores letter case. m (multiline) makes ^ and $ match start/end of each line. s (dotAll) makes . match newlines. u (unicode) enables full Unicode matching.
Greedy quantifiers (
*, +, {n,m}) match as much as possible. Lazy quantifiers (*?, +?, {n,m}?) match as little as possible. For example, given "<b>bold</b>", the pattern <.+> (greedy) matches the entire string, while <.+?> (lazy) matches only "<b>".Capture groups are defined with parentheses
(pattern). They capture the matched text so you can reference it in replacements using $1, $2, etc. Named groups use (?<name>pattern) syntax. Non-capturing groups (?:pattern) group without capturing.