Regex Tester
Test regular expressions with live match highlighting, capture groups, and replace mode. 100% in-browser.
Enter a pattern and test string to see matches
Test regular expressions with live match highlighting, capture groups, and replace mode. 100% in-browser.
Enter a pattern and test string to see matches
g (global) — find all matches, not just the first. Without this, only the first match is returned.i (ignore case) — makes the pattern case-insensitive, so ABC matches abc, Abc, etc.m (multiline) — ^ and $ match the start/end of each line, not just the entire string.s (dotAll) — the dot . matches newline characters as well.u (unicode) — enables full Unicode mode including \u{XXXX} escapes and proper surrogate pair handling.
Use (?<name>pattern) to name a capture group. Example: (?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2}) for ISO dates. In replace mode, reference them with $<name>.
Catastrophic backtracking — patterns like (a+)+ or (.*a){10} can cause exponential time complexity on non-matching strings. Avoid nested quantifiers on overlapping patterns.
Greedy vs lazy quantifiers — .* is greedy (matches as much as possible), while .*? is lazy (matches as little as possible). Use lazy quantifiers when you want the shortest match, e.g., matching HTML tags: <.*?> instead of <.*>.
Anchors in multiline mode — without the m flag, ^ matches only the very start of the string. Enable multiline mode if you want per-line anchoring.