Regex Tester
Type a regular expression, toggle the flags, and test it against your own text — matches highlight live, with groups and indices listed.
Just the pattern — no leading/trailing slashes. Everything stays in your browser.
Regex cheat sheet
The tokens you'll reach for most — keep this tab open while you build your pattern.
| Pattern | Means | Example |
|---|---|---|
. | Any character except newline | a.c matches "abc" |
\d | Digit (0–9) | \d+ matches "42" |
\w | Word character (letters, digits, _) | \w+ matches "hello" |
\s | Whitespace | \s+ matches spaces |
* + ? | Zero or more / one or more / optional | ab? matches "a" or "ab" |
{n,m} | Between n and m times | \d{3,4} matches "1234" |
^ $ | Start / end of string (of each line with m) | ^Hi matches "Hi there" |
[abc] [^abc] | Any of / none of these characters | [aeiou] matches "a" |
(...) | Capture group | (\d+)-(\d+) captures "2026-10" |
(?:...) | Non-capturing group | (?:ab)+ matches "abab" |
| | Either / or | cat|dog matches "dog" |
\b | Word boundary | \bcat\b matches "cat", not "cats" |
\ | Escape a special character | \. matches a literal dot |
g i m s u | Flags: global, ignore case, multiline, dot-all, unicode | /abc/i matches "ABC" |
How to test a regular expression
Regular expressions are powerful but unforgiving — one misplaced parenthesis and nothing matches. A regex tester closes the feedback loop: you write the pattern, paste real sample text, and instantly see what the engine actually matches, character by character.
- Type your pattern in the box above — no slashes needed, just the expression itself.
- Pick your flags.
gfinds every match (not just the first),iignores case,mmakes^and$work per line,slets the dot match newlines, anduenables unicode mode. - Paste test text — the real data your pattern will face, including the edge cases.
- Read the matches. Each match is highlighted in the text and listed with its index and captured groups, so you can verify the groups feed your code correctly.
Start small, then grow the pattern
The fastest way to build a tricky expression is one token at a time: get \d+ matching numbers first, then wrap it in a group, then add the surrounding context. When a change breaks everything, the red error box tells you exactly which part of the pattern the engine rejected.
What is a regex tester?
A regex tester lets you try out a regular expression against sample text and instantly see which parts match, including captured groups and match positions.
How do I test a regex pattern with the flags?
Type your pattern, tick the flags you need (g for global, i to ignore case, m for multiline, s so the dot matches newlines, u for unicode), paste sample text, and every match is highlighted with its index and captured groups listed.
Why is my regular expression not matching?
Common culprits: forgetting the g flag (so only the first match shows), special characters that need escaping (like the dot or parentheses), or anchors like ^ and $ that need the m flag for multiline text. This regular expression tester online shows exactly what the engine sees.
What do the captured groups mean?
Parentheses in your pattern capture the text they match. For example, (\d+)-(\d+) on 2026-10-03 captures 2026 as group 1 and 10 as group 2.
Is my pattern or test text sent anywhere?
No — your browser's built-in regular expression engine does all the work on your own device. Nothing is uploaded or stored.
What does the error message mean?
The red box shows the exact SyntaxError message from the JavaScript regex engine — for example, an unterminated character class like [a-. Fix the highlighted part of your pattern and the results update live.
Kept alive by readers like you
Every tool in the codex is free. If they save you time, a small donation inscribes new pages.
DonateMore from the codex
Regex Tester
Test regular expressions against sample text.
Story Time Read-Aloud
Over 1,000 public-domain children's stories read aloud for the classroom.
Open tool → LiveJSON Formatter
Validate, format, and minify JSON.
Open tool → LiveURL Encoder / Decoder
Encode/decode URLs and parse query strings.
Open tool → LiveBase64 Encoder
Encode and decode Base64, URL-safe too.
Open tool → LiveCase Converter
UPPER, lower, Title Case and more.
Open tool → LiveWord Counter
Count words and estimate reading time instantly.
Open tool → LiveUnix Timestamp Converter
Convert timestamps to dates and back.
Open tool →