Free Tool

Free Regex Tester

Build and debug regular expressions with live match highlighting and capture groups. Everything runs in your browser.

/ /
Highlighted matches
Match details (0)
Replace with — supports $1, $2 back-references
Result after replace

What is a regex tester?

A regex tester is a tool that runs a regular expression against sample text and shows you exactly what it matches. A regular expression is a pattern for finding and extracting text — emails, dates, codes — and a tester lets you build that pattern by trial and error instead of guessing.

This tester runs entirely in your browser using the native JavaScript regex engine. Your pattern and text are never uploaded or stored anywhere.

How to test a regular expression

1

Enter your pattern

Type the regular expression between the slashes and pick any flags you need.

2

Add test text

Paste the text to search. Matches highlight live as you type.

3

Read the matches

Check the match list below, including each capture group and its index.

What this tool offers

Live highlighting

Matches highlight in the text as you edit the pattern.

Capture groups

Every match lists its groups and character index.

All common flags

Toggle global, ignore-case, multiline, and dotall.

Instant error feedback

An invalid pattern shows the engine's error message.

Syntax cheat sheet

A built-in reference for the common regex tokens.

100% in your browser

Pattern and text never leave your device.

Why use a regex tester?

Regular expressions are powerful but unforgiving — a single misplaced character changes what the whole pattern matches. Writing one blind, then running it in your code and hoping, is slow and error-prone.

A tester closes the loop. You see every match the moment you change the pattern, so you can refine it step by step: too few matches, loosen it; too many, tighten it. The capture-group view also confirms you are extracting the right parts, not just matching the right lines.

Regex syntax cheat sheet

The tokens you will reach for most often.

TokenMatches
\d / \w / \sA digit / word character / whitespace
.Any character except a line break
* / + / ?Zero or more / one or more / optional
{2,5}Between 2 and 5 of the preceding token
[abc] / [^abc]Any one of a, b, c / any character except those
^ / $Start / end of the string (or line, with m)
\bA word boundary
(abc) / (a|b)A capture group / either alternative

Frequently asked questions

Is this regex tester free and private?

Yes. The pattern and test text are processed entirely in your browser with the native JavaScript regex engine. Nothing is uploaded, stored, or sent to a server — it all stays on your device.

What do the flags g, i, m, and s mean?

The g flag finds all matches, not just the first. i makes matching case-insensitive. m makes ^ and $ match at every line. s lets . match line breaks too.

Which regex syntax does it use?

It uses JavaScript regular expressions — the same engine browsers and Node.js run. Most patterns are portable, but features differ slightly from PCRE, Python, or other dialects.

Why is my pattern shown as invalid?

The tester shows the engine's error message. Common causes are an unbalanced bracket or parenthesis, a dangling quantifier, or an unfinished escape. Fix the spot it names and the matches reappear.

Can it handle large text?

Yes, within your browser's memory. Note that a poorly written pattern can be slow on long text — this is called catastrophic backtracking and affects only your own browser tab.

Run a website? Let Knowster answer your visitors.

Knowster is an AI chat assistant you add to your site in minutes. It replies to customer questions instantly, around the clock.

Get started free