Regex Tester

Test a regex live — 7 flags, group offsets, a plain-English explanation, test cases, a share link and code for 8 languages. Free, in your browser.

What this pattern does
\ba word boundary
\w+repeated one or more times
\wany letter, digit or underscore
@the text "@"
\w+repeated one or more times
\wany letter, digit or underscore
\.the character "."
\w+repeated one or more times
\wany letter, digit or underscore
\ba word boundary
Quick reference
Character classes
\ddigit 0–9
\wword char (a–z 0–9 _)
\swhitespace
.any char
[abc]a, b or c
[^abc]not a/b/c
Anchors
^start of string/line
$end of string/line
\bword boundary
Quantifiers
*0 or more
+1 or more
?0 or 1
{n}exactly n
{n,}n or more
{n,m}n to m
*?lazy (fewest)
Groups
(…)capture group
(?:…)non-capturing
(?<name>…)named group
\1backreference
a|ba or b
Flags
gglobal
iignore case
mmultiline
sdotall
uunicode
ysticky

2 matches

Email me at hi@example.com or team@site.org.

#1 hi@example.com (at 12–26)

#2 team@site.org (at 30–43)

Extracted matches
Result
Test cases

One string per line. Start a line with "- " for a string that must NOT match, "+ " for one that must.

Use this pattern in code
import re

pattern = re.compile(r"\b\w+@\w+\.\w+\b")
matches = pattern.findall(text)

🔒 Matched in your browser with the native regex engine — your text is never uploaded.

Test regular expressions live

Type a pattern and some test text and every match is highlighted instantly, with capture groups colour-coded inside the text and a legend naming each one. Underneath, every match is listed — its value, its start–end offset, each group's value and offset, and any named groups from (?<name>…) — whether or not the pattern has capture groups at all. All seven JavaScript flags are switches: g, i, m, s, u, v (unicode sets) and y (sticky), and turning g off really does stop at the first match. An invalid pattern shows a clear error with the engine's own message beside it, and a pattern whose nested quantifiers could backtrack exponentially is refused before it runs rather than freezing the tab.

What this pattern does reads the pattern back as an indented list — one row per construct, the token it came from next to a plain sentence such as capture group 1 or repeated one or more times. A written explanation, not a railroad diagram. A Quick reference panel keeps the common syntax a click away.

Below the matches sit a live replace preview with $1 group references; an extract box that pulls the full match, any numbered group or any named group out of every match at once, and downloads them as .txt (one per line), .csv (index, match and a column per capture group, RFC-quoted) or .json (offsets and named captures included); a Test cases panel that scores one string per line pass or fail (- in front of a string that must NOT match); and Use this pattern in code, which emits your pattern as a working snippet in JavaScript, Python, Java, C#, Go, PHP, Ruby or Rust — quoted the way that language quotes a regex — with a note wherever the target engine differs: Go and Rust are RE2 and have no lookaround or backreferences, Python spells a named group (?P<name>…), and Ruby's /m is what s means here.

Copy link puts the pattern, flags, test string and replacement in the URL so someone else opens exactly what you are looking at; a state too big for a link is refused with a sentence instead of handed over cut in half. Add matching example appends a string your pattern really matches — checked against the engine before it is shown — without throwing away what you were already testing. Paste your text, or open a text file up to 5 MB. Matching uses your browser's native regex engine (JavaScript flavor), so your text never leaves your device; a very large paste is capped at 100,000 characters with a notice.

Frequently asked questions

Which regex flavor is this?

Matching is JavaScript's built-in regular expressions and nothing else — the same engine Node.js and every browser uses; there is no PCRE, Python or RE2 engine bundled here. What the tool does do is emit your pattern as code for JavaScript, Python, Java, C#, Go, PHP, Ruby or Rust, and warn you wherever that engine differs: Go and Rust are RE2 and reject lookaround and backreferences, Python writes a named group as (?P<name>…), Ruby's /m means what the s flag means here, and sticky (y) and unicode sets (v) are JavaScript-only.

Can I see capture groups?

Yes, several ways. Each group is tinted inside the highlighted text with a legend saying which colour is which group; every match is then listed with its own start–end offset and the start–end of each group; named groups written (?<name>…) are shown by name; and the extract box pulls the full match, any numbered group or any named group out of every match at once. The match list appears even for a pattern with no capture groups at all.

Can I test a find-and-replace?

Yes — type a replacement (with $1, $2 group references) and see the replaced text update live, ready to copy.

Is my text uploaded?

No. Matching runs entirely in your browser.

Can I share what I am testing?

Yes. Copy link puts the pattern, flags, test string and replacement into the URL (?p=&f=&t=&r=), and opening that link fills the tool back in. If the result would be longer than 8,000 characters — past what chat apps, mail clients and shorteners reliably carry — the tool says so and refuses, rather than handing you a link that arrives cut in half. A link whose flags are not a valid set is reported too, and the flags on the page are left alone.

Does it explain what my pattern means?

Yes. The "What this pattern does" panel breaks the pattern into one row per construct, indented by how deeply it nests, each row showing the piece of the pattern it came from next to a plain sentence — "capture group 1", "any digit 0–9", "repeated one or more times", "only where the text ahead is". It is a written explanation, not a railroad diagram.

Can I check a list of strings against the pattern?

Yes — open Test cases and write one string per line. A bare line (or one starting with "+ ") must match; a line starting with "- " must not. Each line is marked with a tick or a cross and what it was asked to do, and the panel scores them, as in "3 of 4 cases pass". The g and y flags are dropped for this check, because a test case asks whether the pattern finds anything in that string rather than where the search starts.

Can I export the matches?

Yes. Pick a format and press Download matches: .txt is one match per line, .csv has an index column, the match and a column per capture group (quoted the RFC way, so a comma or quote in a match survives), and .json carries every match's offset, each group's start and end, and the named captures. The on-screen detail list stops at 200 matches so a huge paste cannot freeze the page, but the download, the extract box and the highlighting all cover every match.

Why was my pattern refused before it ran?

Because of how the pattern is built, not how long your text is. A pattern with nested quantifiers that can backtrack exponentially — the classic (a+)+ shape — is analysed structurally before anything runs and refused, since a single exec() of one of those freezes the tab and nothing can interrupt it. Turning on the u and v flags together is also stopped, in the tool's own words rather than the engine's English message.

Can it invent text that matches my pattern?

Yes. "Add matching example" builds a string your pattern really matches and appends it to the test string instead of replacing what you were testing; press it again for another one. Each candidate is run against the real engine before it is shown, so a string it gives you always matches. Patterns that describe where a match may sit rather than what it contains — lookahead, lookbehind, \B and Unicode properties like \p{L} — produce nothing at all, with a sentence saying why, rather than text that quietly fails.