Regex Tester — Debug Patterns Live
Type a regular expression and watch it match your sample text in real time — with highlighted matches, capture-group breakdowns, flag toggles, and a substitution tester. JavaScript regex, running entirely in your browser.
Pattern
Enter the pattern body only — no surrounding slashes. Toggle flags below, or pick a starter from the cheat sheet.
Test text
Matches update live as you type. Your text is escaped before display, so HTML in it is shown as text — never rendered.
Enter a pattern above to begin.
Groups appear here once your pattern matches.
Substitution tester
Try a replacement string against the same pattern and text. Use $1, $2 … for capture groups, $& for the whole match.
Replacement result appears here.
Patterns and test text are evaluated locally with JavaScript. Nothing you type ever leaves your browser.
Test as many patterns as you like, instantly — no account, no email, no limits.
Live highlighting, capture groups, substitution, and the cheat sheet — all free, always.
How to use
- 1Enter your pattern
Type the regex body without surrounding slashes — for example
(\w+)@(\w+). Toggle flags like g, i, and m, or load a starter from the cheat sheet. - 2Paste test text
Drop in the string you want to test against. Every match lights up in green the moment you type, with a live match count.
- 3Inspect groups and substitutions
Open the capture-group table to see what each (…) group grabbed, then try a replacement like [$1] to preview substitutions.
Features
Matches re-compute on every keystroke in the pattern, flags, or test text — no Run button, no waiting.
See every match with its index, the full matched text, and each group’s value side by side. Unmatched groups are labeled clearly.
One-click toggles for g, i, m, s, u, and y — with plain-English labels so you always know what each flag does.
Test replacement strings with $1, $2, and $& placeholders against your live pattern before using them in code.
One click loads a tested pattern for email, URL, US phone, MM/DD/YYYY date, IPv4, or hex color — then tweak it freely.
Invalid patterns show the browser’s exact error (like “Unterminated group”) instead of failing silently, so you know what to fix.
