Regex Tester
Write a pattern, paste a test string and watch every match highlight instantly, with a table of capture groups.
Runs in your browser. Your files are never uploaded.
Loading Regex Tester…
How to use Regex Tester
- Enter your regular expression in the pattern box.
- Toggle flags such as i (ignore case) or m (multiline).
- Paste text and review the highlighted matches and group table.
Regex in one minute
A regular expression describes a pattern of text. Plain characters match themselves, and special symbols add flexibility: . matches any character, \d a digit, \w a word character, + means one or more, * zero or more, ? optional, and parentheses create groups you can capture.
Handy patterns to try
- Email (simple): [\w.+-]+@[\w-]+\.[\w.]+
- Digits only: ^\d+$
- Date like 2026-10-17: (\d{4})-(\d{2})-(\d{2})
- Hex colour: #?([0-9a-f]{3}|[0-9a-f]{6})
- Words starting with A: \bA\w*
Avoiding common traps
Greedy quantifiers match as much as they can: <.+> grabs from the first < to the last > on the line, while <.+?> stops at the first >. Nested quantifiers such as (a+)+ can cause catastrophic backtracking that freezes a page, so test patterns on realistic input before using them in production. Remember that regex is a poor fit for fully parsing HTML or complex email validation.
Learning regular expressions step by step
Start with literal text, confirm it highlights, then add one feature at a time. Anchors ^ and $ pin a match to the start and end of a line (with the m flag) or of the whole text. Character classes like [A-Z] match one character from a set. Quantifiers such as {2,4} control repetition. Groups in parentheses let you capture parts of a match, which the table below the preview lists as $1, $2 and so on.
Use the non-capturing form (?:…) when you only need grouping. Lookaheads like (?=…) check what follows without consuming it. Because this tool uses your browser’s JavaScript engine, anything that works here works in a JavaScript or TypeScript project.
Why use this regex tester tool
- Live highlighting. Matches update as you type.
- Capture groups. See each group value and its index.
- Clear errors. Syntax problems are reported immediately.
Frequently asked questions
Which regex flavour is this?
JavaScript (ECMAScript) regular expressions, as run by your browser. Most basics carry over to other languages, but features like lookbehind or named groups differ between engines.
What do the flags mean?
g finds all matches, i ignores case, m makes ^ and $ match at each line, s lets . match newlines, u enables full Unicode.
Why does my pattern match nothing?
Common causes: forgetting to escape special characters like . or ( with a backslash, anchoring with ^ and $ without the m flag, or case differences without the i flag.
More free tools
PX to REM Converter
Convert pixels to rem and em, and back, with a custom root font size. Includes a table of common sizes from 8px to 64px and a copy-ready CSS declaration.
Open toolBase64 Encode & Decode
Encode text to Base64 or decode Base64 back to text. Supports UTF-8 and URL-safe Base64. Free, instant and runs in your browser.
Open toolURL Encode & Decode
Encode or decode URLs and query strings with percent-encoding. Choose component or full-URL mode. Free, instant and private.
Open tool