Regex Tester
Write a pattern and see every match highlighted as you type, with groups and a replace preview.
Matches
Replace
How it works
Enter a pattern (without slashes) and flags. Matches are highlighted in the text in alternating colours, and the list below shows each match's position and capture groups, including named groups like (?<year>\d{4}).
Type a replacement to preview String.replace: $1 inserts a group, $& the whole match and $<name> a named group. Without the g flag only the first match is replaced.
Common flags: i ignores case, m makes ^ and $ match at line breaks, s lets . match newlines and u enables full Unicode, including \p{L} letter classes. Matching stops after 1,000 matches or 300 ms so a runaway pattern cannot freeze the page.
Questions
Which regex flavour is this?
JavaScript (ECMAScript). Most syntax matches PCRE and Python, but lookbehind support and some escapes differ.
Why does my pattern match empty strings?
Patterns like a* can match zero characters. Those are shown as ∅ marks; use + instead of * if you need at least one character.
Is my text uploaded?
No. The regular expression engine is your browser's own.