Regex Tester
Test, highlight, and learn regular expressions.
2 matches
Contact [email protected] or jo.[email protected] for details. Not an email: hello world.
| Match | Group 1 | Group 2 |
|---|---|---|
| [email protected] | sam | example.com |
| [email protected] | doe | mail.co.uk |
What your pattern means
(Start of a capturing group\wAny word character (a–z, A–Z, 0–9, _)+One or more (greedy))End of group@Literal "@"(Start of a capturing group\wAny word character (a–z, A–Z, 0–9, _)[\w.]Any character in the set [\w.]*Zero or more (greedy)\.Literal "."\wAny word character (a–z, A–Z, 0–9, _)+One or more (greedy))End of group
Regex cheat sheet — symbols, meanings, and examples
Character classes
.Any character except newline— a.c → abc, a2c\dA digit (0–9)— \d\d → 42\wWord character (a–z, 0–9, _)— \w+ → hello_1\sWhitespace (space, tab, newline)— a\sb → 'a b'[abc]Any one of a, b, or c— [aeiou] → a vowel[^abc]Any character except a, b, c— [^0-9] → non-digit[a-z]A range of characters— [A-Z] → any capital
Anchors & boundaries
^Start of the string / line— ^Hi → line starting 'Hi'$End of the string / line— end$ → line ending 'end'\bA word boundary— \bcat\b → the word 'cat'
Quantifiers
*Zero or more— ab* → a, ab, abbb+One or more— ab+ → ab, abbb?Optional (zero or one)— colou?r → color, colour{3}Exactly 3 times— \d{3} → 123{2,4}Between 2 and 4 times— \d{2,4} → 12–1234*?Lazy — as few as possible— <.*?> → shortest tag
Groups & alternation
(abc)Capturing group— (ab)+ → abab(?:abc)Non-capturing group— (?:ab)+ → groups without capturing(?<name>…)Named capturing group— (?<year>\d{4})a|bMatch a OR b— cat|dog → cat, dog(?=…)Lookahead (followed by)— \d(?=px) → digit before 'px'
Flags
gGlobal — find all matches— /a/giCase-insensitive— /abc/i → ABCmMultiline — ^ and $ per line— /^x/msDotall — . matches newline too— /a.b/s
Runs entirely in your browser — nothing you enter is uploaded or sent to a server.
Patterns run on your browser's JavaScript regex engine, so they behave as they do in JavaScript — other flavours (PCRE, Python, Go) differ in places, so test in your target language before you rely on one. Read our full disclaimer.
About this tool
A regex playground built for both getting work done and learning. Type a pattern and sample text and it highlights every match live, lists the capture groups, and — crucially — explains your pattern in plain English, token by token. A built-in cheat sheet covers the common symbols with meanings and examples, so you can practise and understand what each piece does. Toggle the i, m, and s flags as needed. It runs on your browser's native regular-expression engine.
Try it
The pattern (\w+)@(\w[\w.]*\.\w+) finds emails and captures the name and domain as groups. The breakdown explains each symbol; the cheat sheet shows more.
How to use
- 1Type your regular expression in the pattern box.
- 2Toggle flags (ignore case, multiline, dotall) — global is always on.
- 3Enter or paste the text to test against and see matches highlighted.
- 4Read the plain-English breakdown of your pattern, and open the cheat sheet to learn more.
Features
- Live match highlighting with a capture-group breakdown.
- Plain-English explanation of your pattern, token by token.
- A learn-by-example cheat sheet of common symbols.
- Toggle the i, m, and s flags (global is always on).
Frequently asked questions
Which regex flavour does it use?
JavaScript's built-in regular expression engine, running in your browser. Patterns behave exactly as they would in JavaScript.
Is the global flag always on?
Yes — the tester finds all matches, so it always uses the global flag. You can additionally toggle ignore-case (i), multiline (m), and dotall (s).
Can it explain any pattern?
It breaks down the common metacharacters, quantifiers, groups, and character classes in plain English. It's a learning aid, so extremely exotic constructs may be labelled generically.
More developer tools
View allJSON Formatter
Paste raw JSON and get it neatly indented, minified, or validated — entirely in your browser.
Open toolText Diff
Compare two blocks of text line by line and see exactly what was added, removed, or left unchanged.
Open toolURL Encoder / Decoder
Encode text so it's safe to put in a URL, or decode percent-encoded text back to readable form.
Open tool