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
No. All regex matching, highlighting, and replacement happens entirely in your browser using JavaScript's native RegExp engine. Your patterns and test data never leave your device.
The tester supports all standard JavaScript regex flags: g (global — find all matches), i (case-insensitive), m (multiline — ^ and $ match line boundaries), s (dotAll — dot matches newline), and u (Unicode mode). Toggle any combination of flags using the flag buttons.
Use the (?<name>pattern) syntax to create named capture groups. For example, (?<year>\d{4})-(?<month>\d{2}) captures year and month separately. The tester displays each group's name and matched value in the Matches panel, making it easy to verify complex extraction patterns.
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.