Regex Tester
Type a pattern, see matches highlighted in your test text. Capture
groups are listed below. JavaScript regex flavor — your browser's
native RegExp.
Matches with capture groups
Flag reference
| Flag | Meaning |
|---|---|
g | Global — find all matches, not just the first |
i | Ignore case — A matches a |
m | Multiline — ^ and $ match line boundaries |
s | Dotall — . matches newlines too |
u | Unicode — strict Unicode mode, enables \\p{...} |
y | Sticky — match at exact lastIndex position |
How it differs from regex101
regex101 is the
long-standing champion in this space — it supports PCRE, Python,
Java, .NET, Go, and other flavors. This tool is JavaScript-only by
design (it uses your browser's native RegExp), which
means:
- Faster. Native regex execution; no WebAssembly engine to load.
- Smaller bundle. Under 5KB of JavaScript total.
- True to JS semantics. What you test here is exactly what your
String.match()/RegExp.exec()calls will do in production. - No PCRE-only features. If you need recursion, atomic groups, or possessive quantifiers, use regex101 — JavaScript doesn't support them.
For most web/Node code, JS-native is what you want. For other languages, consult our flavor comparison.
Common patterns
| Pattern | Matches |
|---|---|
\\b\\w+@\\w+\\.\\w+\\b | Simple email (not RFC-compliant — see warning below) |
https?:\\/\\/\\S+ | HTTP / HTTPS URL |
\\b\\d{3}-\\d{2}-\\d{4}\\b | US Social Security number format |
\\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\\b | UUID |
^\\s*$ (with m) | Empty lines |
(?<year>\\d{4})-(?<month>\\d{2})-(?<day>\\d{2}) | ISO date with named groups |
Common pitfalls
- Email regex is hard. The "simple email" above misses many valid forms (sub-addressing with
+, internationalized domains, dots in local part). For real validation, use a library or accept anything with an@and let the SMTP layer reject bad addresses. - HTML parsing. Don't. Use a parser. Regex can't reliably handle nested tags or arbitrary attribute orders.
- Catastrophic backtracking. Patterns like
(a+)+bonaaaaaaa!can take seconds to fail. Watch for nested quantifiers; prefer atomic patterns or possessive quantifiers (in flavors that support them — JS doesn't). - Unicode without the
uflag. Withoutu,\\wonly matches ASCII word chars,.doesn't handle astral characters correctly. Addufor any text that includes non-Latin scripts.
Try the related tools
- Find and replace — apply a regex with capture-group substitution
- Cheat sheet — every regex token in one page
- Regex flavors — JS vs Python vs PCRE vs others
FAQ
Which regex flavor does this use?
Your browser's native ECMAScript regex (the same as new RegExp() in JavaScript). Most patterns work — but PCRE-specific features like (*FAIL), (?R) recursion, or balancing groups will not. See regex flavors for cross-language differences.
How does match highlighting work?
The pattern runs against the test text with a g flag. Each match is wrapped in a <mark> for visual highlight. Capture groups are listed below the result.
Why does my regex match nothing?
Most common causes: (1) missing g flag (only finds the first match), (2) special characters not escaped (. matches anything; \. matches a literal dot), (3) anchors (^ / $) without the m flag on multiline input, (4) typo in a character class.
What's the safety cap on matches?
Hard cap of 10,000 matches per run to prevent the page from freezing on pathological patterns. Only the first 50 are listed in detail below the editor; the count and highlights cover all.
Is my regex / text sent anywhere?
No. Both the pattern and the test text run through your browser's native RegExp constructor. Open DevTools → Network and verify — no requests are made.
How do I do a multiline match?
Tick the m flag — that makes ^ and $ match start/end of each line, not just the whole input. For matching a newline with ., also tick s (dotall).