Regex Tester
What is the Regex Tester?
The Regex Tester lets you write a regular expression and see, as you type, exactly what it matches in a sample text. Matches are highlighted in the text, each match is listed with its capture groups and position, and a status line tells you when the pattern is invalid and why. Toggle the g, i, m, s, u and y flags with one click and try a replacement string to preview the output. It uses your browser’s own JavaScript regex engine, so what works here works in Node, the browser, and any tool that follows the same syntax.
How to use it
- Type or paste a pattern between the slashes. Do not add the slashes yourself.
- Tick the flags you need. g finds all matches rather than the first, i ignores case, m makes ^ and $ match at line breaks, s lets . match newlines, u enables full Unicode, y anchors at the last match position.
- Paste sample text. Matches light up immediately and the count updates.
- Open the match list to see each match, its index, and the contents of every numbered or named group.
- Optionally enter a replacement (use $1, $2 or $<name> for groups) to preview the replaced text, then copy it.
Features
- Live highlighting over the original text, so you can see boundaries and overlaps.
- Group breakdown for numbered and named capture groups on every match.
- Clear error messages for unbalanced brackets, bad escapes and invalid quantifiers.
- Replace preview using the same substitution syntax as String.replace.
- Runs locally. Log files, customer data and source code never leave your machine.
Quick reference
.any character except newline ·d w sdigit, word character, whitespace ·bword boundary* + ? {n,m}quantifiers; add?after them for lazy matching[abc] [^abc] [a-z]character classes ·(x) (?:x) (?<name>x)capturing, non-capturing, named groups(?=x) (?!x) (?<=x) (?<!x)lookahead and lookbehind^ $start and end of input (or of line with the m flag)
The full cheat sheet, with ready-made patterns for emails, URLs, dates, IPs and the bugs everyone hits (greedy matching, forgetting to escape a dot, catastrophic backtracking), is in the regex cheat sheet.
Common patterns to paste in
- Email (practical, not RFC-perfect):
[w.+-]+@[w-]+.[w.-]+ - URL:
https?://[^s/$.?#].[^s]* - ISO date:
d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]d|3[01]) - IPv4:
b(?:(?:25[0-5]|2[0-4]d|1?d?d).){3}(?:25[0-5]|2[0-4]d|1?d?d)b - Hex colour:
#(?:[0-9a-fA-F]{3}){1,2}b
Related tools
Clean up JSON before matching against it with the JSON Formatter, count characters in your test string with the Character Counter, or decode Base64 payloads with the Base64 Encoder / Decoder.
Read the guide
Regex Cheat Sheet: The Syntax That Matters, Ready Patterns, and the Bugs Everyone Hits
Regex is fifteen small pieces, and most jobs use five. The syntax table, ready patterns for email, URL, dates, passwords and duplicates, the greedy-vs-lazy bug, flags, dialect differences, and three rules for using it safely.
Frequently asked questions
Which regex flavour is this?
JavaScript (ECMAScript). Most syntax is shared with PCRE, Python and Go, but there are differences: JavaScript has no possessive quantifiers or atomic groups, and lookbehind support depends on the engine version. Named groups use (?<name>...).
Why does my pattern match only once?
The g flag is off. Turn it on to find every match.
Why does ^ not match the start of each line?
Enable the m (multiline) flag. Without it, ^ and $ refer to the start and end of the whole string.
Can I test very large texts?
Yes, though a pattern with nested quantifiers on a large input can take a while. If the page stalls, simplify the pattern; that is usually a sign of catastrophic backtracking that would bite in production too.
Guides you might like
Short, practical reads that pair with this tool.
More Developer & Code Tools
Free, in your browser, no sign-up.





