Regex Tester
Test JavaScript regular expressions live: highlighted matches, capture-group inspection, all six flags, a pattern library, find-and-replace preview and a copyable code snippet, all in your browser.
Highlighted matches (3 matches)
Contact ada@example.com or help+regexkit@mail.co.uk for support. Orders go to sales@shop-example.org, but not to not-an-email@.
Match details
| # | Match | Index | Capture groups | Named groups |
|---|---|---|---|---|
| 1 | ada@example.com | 8 | 1: "ada", 2: "example.com" | none |
| 2 | regexkit@mail.co.uk | 32 | 1: "regexkit", 2: "mail.co.uk" | none |
| 3 | sales@shop-example.org | 78 | 1: "sales", 2: "shop-example.org" | none |
Substitution (find and replace)
Replacement uses your flags exactly as typed: without g, only the first match is replaced, just like String.replace in JavaScript.
Contact ada at example.com or help+regexkit at mail.co.uk for support. Orders go to sales at shop-example.org, but not to not-an-email@.
Common patterns
Pick one to load it into the pattern field.
Use it in code
const re = /(\w+)@([\w.-]+\.[a-z]{2,})/g;
const matches = [...text.matchAll(re)];
// matches[i][0] = full match, matches[i][1..] = capture groupsThe snippet uses matchAll, so it lists every match with its capture groups.
Privacy: matching runs locally in your browser with the JavaScript RegExp engine. Your pattern and test text are never uploaded, stored or logged.
More developer tools: JSON Formatter, Base64 Encoder & Decoder, UUID Generator, Text Diff Checker
How this calculator works
A regular expression, or regex, is a compact pattern that describes a set of strings: \d+ means one or more digits, \w+@ means one or more word characters followed by an at sign, and ^ anchors a match to the start of a line. Developers use regex to validate form input, pull emails out of text, rewrite log lines, and rename files in bulk. The catch is that a pattern that looks right often matches the wrong thing, or nothing at all, and the only way to know is to run it against real text. That is what a regex tester does: you type the pattern, paste the text, and every match lights up at once.
Worked example: load the example and the pattern (\w+)@([\w.-]+\.[a-z]{2,}) runs against a contact paragraph. It finds three email addresses, ada@example.com, regexkit@mail.co.uk and sales@shop-example.org, while correctly skipping not-an-email@, which has no domain. The match table shows why each match worked: group 1 holds the username (ada, regexkit, sales) and group 2 holds the domain (example.com, mail.co.uk, shop-example.org). Toggle the i flag and the same pattern starts matching uppercase addresses too; drop the g flag and only the first address is found, which is exactly how String.replace behaves without g.
Three things make this tester safer than pasting patterns into a random site. First, everything runs locally in your browser on the JavaScript RegExp engine, the same engine Node.js and every browser use, so a pattern that passes here behaves identically in your code, and your test text is never uploaded, stored or logged. Second, invalid patterns fail loudly with the engine own error message instead of silently matching nothing, which catches unbalanced brackets and bad quantifiers at once. Third, the match table exposes capture groups, including named groups, so you can confirm group order before the pattern ships. One honest warning: nested quantifiers like (a+)+ on near-matching input can take exponential time, a flaw called catastrophic backtracking, so test suspicious patterns against your longest real input before deploying them. Pair this tester with the JSON Formatter, Base64 tools and Diff Checker in the same developer cluster.
