🔍 Regex Tester
Quick answer
A regular expression is a pattern that describes a set of strings — for example \d+ matches one or more digits and ^[A-Z] matches text starting with a capital letter. This tester highlights every match in your test text as you type and lists each match with its index and capture groups.
6 matches found
| # | Match | Index | Groups |
|---|---|---|---|
| 1 | 66 | 6 | — |
| 2 | 2026 | 20 | — |
| 3 | 10 | 25 | — |
| 4 | 26 | 28 | — |
| 5 | 450 | 36 | — |
| 6 | 12 | 56 | — |
Regex cheat sheet
- . — any character (except newline)
- * — 0 or more + — 1 or more ? — 0 or 1
- [abc] — one of a, b, c [^abc] — anything except [a-z] — range
- (abc) — capture group (?:abc) — non-capturing group
- \d — digit \w — word character \s — whitespace
- \D \W \S — the opposites of the above
- ^ — start of string/line $ — end of string/line \b — word boundary
- a|b — a or b {2,4} — between 2 and 4 times
- \. \* \+ — escape a special character with a backslash
✅ 100% free · 🔒 Runs in your browser — files never leave your device · 🚫 No sign-up
How to use the Regex Tester
- Type your regular expression in the pattern box (without the surrounding slashes).
- Tick the flags you need — g finds all matches instead of just the first one.
- Type or paste the test text below.
- Matches are highlighted instantly; the table shows each match, its index and its groups.
- Open the cheat sheet under the tool if you need a quick syntax reminder.
Frequently asked questions
Why does it only find the first match?
Without the g (global) flag, a regular expression stops after the first match — that is standard JavaScript behavior. Tick the g flag to find and highlight every match.
What flavor of regex is this?
This tester uses JavaScript regular expressions, the same engine that runs in browsers and Node.js. Most syntax is shared with other flavors, but lookahead support and class rules can differ slightly from PCRE or Python.
Why does my pattern show an error?
Common causes are an unclosed bracket or parenthesis, a trailing backslash, or an invalid quantifier like **. The error message under the pattern tells you what the JavaScript engine rejected.