Utilities

Regex Tester

Live Matching

Test Your Pattern

Enter a pattern and test string. Matches are highlighted in real-time.

Quick Presets

Email
URL
IPv4
Phone (US)
Date (YYYY-MM-DD)
Hex Color
HTML Tag

/

/

Tool features

Real-time regex testing and debugging
4 features

Real-time Testing

Matches update as you type with 300ms debounce

Capture Groups

View numbered and named capture group values

Replace Mode

Preview regex-based text replacements instantly

Common Presets

One-click patterns for email, URL, IP, phone and more

What is a regular expression & how it works

Describing text patterns to search, validate and replace

A regular expression (regex) is a pattern that describes text: character classes like \d for digits, quantifiers like + and {2,4}, anchors like ^ and $, and groups in parentheses that capture parts of a match.

This tester uses your browser's JavaScript regex engine, highlighting matches and capture groups live as you type, with the g, i, m, s and u flags and a replace mode. Patterns behave the same in Node.js; other languages such as PCRE, Python and Java differ in some syntax details.

Capture group
( … ) saves the matched text for backreferences and replacements ($1, $2).
Flags
g all matches, i case-insensitive, m multiline anchors, s dot matches newlines, u Unicode.
Greedy vs lazy
.* takes as much as possible; .*? takes as little as possible.

How to use this tool

Build and test a regex in four steps
1
Enter a pattern
Type the regex, or start from a preset such as email, URL or IPv4.
2
Set the flags
Toggle g, i, m, s and u to match the behaviour you need.
3
Add test text
Paste sample text; matches and capture groups highlight as you type.
4
Try replacements
Switch to Replace mode and use $1, $2 to reuse captured groups.

Frequently asked questions

Common questions about regular expressions
5 Q&A

JavaScript (ECMAScript), via your browser’s built-in engine. Most syntax carries over to PCRE, Python and Java, but features like lookbehind, named groups and possessive quantifiers vary between engines.

Add the g (global) flag to find every match instead of stopping at the first.

Without the m flag, ^ and $ match only the start and end of the whole text. Turn on m to make them match at line breaks.

Escape it with a backslash: \., \[, \(. Inside a character class most characters are literal, e.g. [.].

Nested quantifiers such as (a+)+ can cause catastrophic backtracking on non-matching input. Make patterns more specific or avoid nesting repetition.