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.
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.
| Pattern | Matches | Example match |
|---|---|---|
\b\w+@\w+\.\w+\b | Email address (basic) | [email protected] |
\d+ | One or more digits | 2026 |
^https?://\S+$ (m flag) | URL starting a line | https://www.example.com |
[0-9a-fA-F]{6} | 6-digit HEX color | 1a2b3c |
\b[A-Z][a-z]+(?: [A-Z][a-z]+)*\b | Capitalized name | Mary Jane Watson |
\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} | IPv4 address | 192.168.0.1 |
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.
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.
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.
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.
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.
If you just finished with Regular Expression Tester, the natural next steps are JSON Formatter & Validator, Text Case Converter, Markdown Live Editor, or browse every tool in Daily Tools.