Regex Tester
Test a regular expression against a string with live highlighting, a full match list with capture groups, and a replace preview. Nothing is sent to a server — everything runs in your browser.
How to use
- Enter a pattern: Type a regular expression between the
/ /and check whichever flags you need (g, i, m, s, u, y). A syntax error in the pattern shows an error message right below it. - Test string: Type the text you want to match against, and matching portions are highlighted live.
- Check the match list: See each match's position, its full matched text, and both numbered and named capture group values. Click 📋 next to any value to copy just that.
- Preview a replace: Open the "Replace" panel and enter a replacement string (reference capture groups with
$1,$2,$<name>) to see the result using the same rules as JavaScript'sString.replace(). Without the g flag, only the first match is replaced.
All matching runs on the browser's built-in JavaScript regex engine; the pattern and string you enter are never sent to a server or stored.
Common flags and patterns
Flags: g (global — find every match) · i (ignore case) · m (multiline — ^/$ match at each line boundary) · s (dotAll — . also matches newlines) · u (unicode mode) · y (sticky — matches only at lastIndex).
A few common patterns:
\b[\w.+-]+@[\w-]+\.[a-zA-Z]{2,}\b— email address^\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}$— US-style phone numberhttps?:\/\/[^\s]+— URL^(?=.*[a-z])(?=.*[A-Z])(?=.*\d).{8,}$— password with lower/upper/digit, 8+ chars(\d{4})-(\d{2})-(\d{2})— YYYY-MM-DD date (captures year/month/day)
Frequently Asked Questions
Is the pattern or test string sent anywhere?
No. All matching and replacing runs entirely in your browser via JavaScript; nothing is sent to a server.
Which regex flavor does this use?
Whatever your browser's JavaScript engine implements. Some syntax (lookbehind support, named-group syntax) can differ from PCRE (PHP) or Python's re module.
I only see one match even with the g flag on — why?
The highlight and match list always find every match, for exploration purposes. The "Replace" result, however, follows real String.replace() semantics: without the g flag, only the first match is replaced. Turn on g to replace all of them.
Can a bad pattern freeze my browser?
Certain patterns (nested repetition, in particular) can trigger "catastrophic backtracking," where matching time grows exponentially for some inputs. That's a property of regex engines in general, not specific to this tool — if the page seems to hang, simplify the pattern or reload the tab.
Are named capture groups supported?
Yes. Write (?<name>...) and the match list will show it by name; in the replacement string you can reference it with $<name>.