Regex Tester — Test Regular Expressions
Test regular expressions with live match highlighting, capture groups and explanations. Supports JavaScript flags: global, case-insensitive and multiline.
—
Regex cheat sheet
.any char ·\wword ·\ddigit ·\swhitespace*0+ ·+1+ ·?0 or 1 ·{n,m}range^start ·$end ·[abc]char class ·[^abc]negated(x)group ·(?:x)non-capturing ·x|yor
About Regex Visualizer
A regular expression (regex) is a compact pattern language for describing text: character classes, quantifiers, anchors, alternation, and capture groups combine to match everything from email addresses to log lines. This visualizer runs your pattern against sample input, highlights every match, and shows what each capture group captured so you can see exactly how the engine interprets the pattern.
Reach for regex when you need text validation, log parsing, extraction, or search-and-replace in scripts and code. Be careful with greedy quantifiers like .* which consume as much as possible — add ? to make them lazy when needed. Also mind the risks: patterns with nested quantifiers can cause catastrophic backtracking (ReDoS) on untrusted input, and different engines differ in features, so a pattern using lookaheads or backreferences may work in PCRE or JavaScript but not in RE2, Go, or MySQL.
Reading a pattern before you write one
A regular expression is read left to right, and each token consumes input or groups it. `\d` is one digit, `\w` is a word character, `.` is any character except a newline, and a quantifier such as `+` or `{3,}` applies to the token immediately before it. Getting that last relationship right is most of the difficulty in writing patterns.
Anchors change the scope of the match rather than what it matches: `^` requires the start of the string (or line, with the multiline flag) and `$` the end. For validation, an unanchored pattern that matches part of a string is almost never what you want.
Greediness and backtracking
A quantifier is greedy by default — `.*` consumes as much as possible and then gives characters back when the rest of the pattern fails. When results are longer than expected, that backtracking is usually the cause, and `.*?` is the first thing to try.
Nested quantifiers such as `(a+)+` can trigger catastrophic backtracking on non-matching input, freezing the page for seconds or minutes. If a pattern is slow rather than wrong, look for nested repetition first.
Flavours are not interchangeable
JavaScript, Python and PCRE agree on the basics and disagree on the edges: `\d` excludes some Unicode digits in some flavours, lookbehind support varies, and named group syntax differs. Test a pattern in the engine that will actually run it.
Frequently Asked Questions
How do I test a regular expression online?
Why is my regex not matching?
Can I test regex against multiple strings at once?
Is my data sent to a server?
Do I need an account or API key?
Can I use these tools offline?
All processing happens in your browser. No uploads, no tracking, no servers. Your API keys, configs, and private payloads stay private — 100% client-side.