Developer Tools

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.

//g
Flags

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

#MatchIndexCapture groupsNamed groups
1ada@example.com81: "ada", 2: "example.com"none
2regexkit@mail.co.uk321: "regexkit", 2: "mail.co.uk"none
3sales@shop-example.org781: "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 groups

The 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.

Frequently asked questions

How do I test a regex online?
Type your pattern without surrounding slashes, pick flags, and paste your test string. Matches highlight instantly, and the match table lists each match with its index and capture groups. Use the pattern library to start from a tested email, URL, phone or UUID pattern.
Which regex flavour does this tester use?
JavaScript (ECMAScript), the engine built into every browser and Node.js. Named groups, lookahead, lookbehind and Unicode property escapes with the u flag all work. PCRE-only features like possessive quantifiers and atomic groups do not exist in JavaScript.
What do the regex flags g, i, m, s, u and y do?
g finds every match instead of just the first; i ignores case; m makes ^ and $ match line boundaries instead of just the text boundaries; s lets . match newlines; u enables full Unicode mode and \p{...} escapes; y (sticky) matches only at the current lastIndex position without searching ahead.
How do capture groups work?
Parentheses capture part of a match: in (\w+)@(\w+), group 1 is the username and group 2 is the domain. Named groups use (?<name>...) syntax and appear in the named-groups column. The full match is always group 0, shown in the match column.
Why does my regex match nothing?
The usual causes are a missing flag (no g means only the first match), a special character that needs escaping (a literal dot is \., a bare . matches any character), and ^ or $ without the m flag on multi-line text. The tester shows the engine error for invalid patterns, so a syntax mistake is easy to spot.
Is my test text uploaded or stored?
No. Matching, replacement preview and snippet generation all run locally in your browser with no server round trip, no account and no storage. Closing the page discards everything you entered, which also makes it safe to test patterns against real log lines.
Disclaimer: Results are estimates for planning purposes only and are not financial advice. Actual loan terms, taxes and investment returns vary. Consult a qualified professional before making financial decisions.