Build, test, and understand regular expressions
Regex is powerful and famously easy to get subtly wrong. These tools handle the everyday regex work — testing, explaining, and reusing patterns — entirely in your browser.
Regex Tester
Test a pattern against sample text with live match highlighting and capture groups.
Regex Replace
Find and replace text using a regular expression, with backreferences.
Regex Explainer
Break down a regex pattern into plain-English tokens.
Common Patterns Library
Copy-ready regex patterns for email, URL, IPv4, and more.
What is a regular expression?
A regular expression (regex) is a short pattern that describes a piece of text. For example, \d{3} means "exactly three digits". Developers use regex to check input such as emails and phone numbers, to search through logs, and to find and replace text in bulk.
Regex is powerful but hard to read, and a small mistake can match far more or far less than you expect. Testing a pattern against real sample text, and seeing every match highlighted, is the quickest way to get it right.
Which tool should I use?
| I want to… | Use |
|---|---|
| Test a pattern and see every match and capture group | Regex Tester |
| Find and replace text with a pattern, using backreferences | Regex Replace |
| Understand what an existing pattern does, piece by piece | Regex Explainer |
| Copy a ready-made pattern for emails, URLs, IP addresses and more | Common Patterns Library |
Private by design
Your patterns and sample text are processed in your browser and never sent to a server, so you can safely test against real log lines or data.
Frequently asked questions
Which regex flavor do these tools use?
They use JavaScript's built-in RegExp engine, the same one used in browsers and Node.js. That includes flags such as g, i, m, s and u, named capture groups and lookbehind. Most patterns also work in other languages, but a few features differ between flavors.
What is a capture group?
A capture group is part of a pattern in parentheses. It saves the text it matched, so you can read that piece separately or reuse it in a replacement, for example as $1.
Why does my regex match too much?
Quantifiers like * and + are greedy: they match as much as they can. Adding ? after them, as in .*?, makes them match as little as possible, which often fixes this.
Should I use regex to validate email addresses?
A simple pattern is fine for catching obvious typos. A fully correct email regex is extremely complex, so the only reliable check is to send a confirmation email.