Regular Expression Tester

Test regular expressions against text with live match highlighting, per-match capture groups, and adjustable g, i, m, s and u flags.

All calculations happen locally in your browser. Nothing leaves your device.

Regex Cheat Sheet

A regular expression is a pattern that describes a set of strings. Mastering it comes down to knowing a dozen or so building blocks — wildcards, character classes, quantifiers, anchors and groups — and how they combine. The table below covers the patterns you will reach for most often.

PatternMatchesExample match
\b\w+@\w+\.\w+\bEmail address (basic)[email protected]
\d+One or more digits2026
^https?://\S+$ (m flag)URL starting a linehttps://www.example.com
[0-9a-fA-F]{6}6-digit HEX color1a2b3c
\b[A-Z][a-z]+(?: [A-Z][a-z]+)*\bCapitalized nameMary Jane Watson
\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}IPv4 address192.168.0.1

Frequently Asked Questions

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

g (global) finds every match instead of stopping at the first. i makes matching case-insensitive. m makes ^ and $ also match the start and end of each line in a multiline string. s (dotall) makes the dot . also match newlines. u enables Unicode mode so characters and \w etc. behave correctly for non-ASCII text.

Why does my pattern match nothing?

Common causes: a missing g flag so only the first occurrence is listed, anchors like ^ that pin the match to a specific position, or special characters that need escaping (a literal dot must be written as \.). Check that the pattern bar does not show the invalid message — an unbalanced parenthesis is a frequent culprit.

What are capture groups?

Parentheses inside a pattern capture whatever text they wrap so you can refer to it separately. (\d{4})-(\d{2})-(\d{2}) produces three groups: year, month and day. This tool lists every group's value under each match in the groups table.

Is my text sent anywhere?

No. The entire matching process runs as JavaScript inside your browser tab using the native RegExp engine. Nothing is transmitted to a server and nothing is stored after you close the page.

Can I use this tool to replace text?

This tool is a tester: it highlights and lists matches, it does not rewrite your text. The same patterns work with your language's replace methods — JavaScript's String.replace(), Python's re.sub() or PHP's preg_replace() — and the group references shown here map directly onto replacement templates like $1 or \1.