Tools

Home
Cron ParserHash GeneratorURL Encode/DecodeEncrypt/DecryptJSON Path TesterFavicon Downloader

Regex Tester

Test regular expressions against text with live matching, capture groups, and replace mode

Your files never leave your browser
//
Test String0 chars, 0 lines
Matches Highlighted0 matches
Matches will be highlighted here...
Match Details0 matches
Ready·

Regex Quick Reference

Character Classes

.Any character (except newline)
\dDigit [0-9]
\DNon-digit
\wWord char [a-zA-Z0-9_]
\WNon-word character
\sWhitespace
\SNon-whitespace
[abc]Character set (a, b, or c)
[^abc]Negated set
[a-z]Range

Quantifiers

*0 or more
+1 or more
?0 or 1 (optional)
{n}Exactly n times
{n,}n or more times
{n,m}Between n and m times
*?Lazy (non-greedy) *
+?Lazy (non-greedy) +

Anchors & Groups

^Start of string/line
$End of string/line
\bWord boundary
(abc)Capturing group
(?:abc)Non-capturing group
(?<name>abc)Named group
a|bAlternation (a or b)
\1Backreference to group 1

Lookahead & Lookbehind

(?=abc)Positive lookahead
(?!abc)Negative lookahead
(?<=abc)Positive lookbehind
(?<!abc)Negative lookbehind

Flags

gGlobal: find all matches
iCase insensitive
mMultiline: ^ $ match lines
sDotall: . matches newlines
uUnicode support

Replacement Tokens

$1First capture group
$2Second capture group
$&Entire match
$`Before the match
$'After the match
$$Literal $

Type a regex pattern, paste your test string, and see every match highlighted as you go — no need to keep rerunning scripts after each tiny edit. Capture groups, indexes, and a built-in replace mode are all visible at once. And everything runs in your browser. Nothing gets uploaded.

How It Works

Type Pattern + Flags
➔
Engine Matches Live
➔
Highlights + Groups Shown

The tool compiles your regex using JavaScript's native RegExp engine on every keystroke. It runs the pattern against your test string and highlights every match in real time. Capture groups, indexes, and match lengths are pulled from the result object and displayed below the panes. Turn on Replace mode and it calls String.replace() with your substitution string — including group backreferences like $1.

Examples

Extracting email addresses from a paragraph

You have a block of text and need to pull out every email. One pattern, global flag on.

INPUT
Pattern: [\w.+-]+@[\w-]+\.[\w.]+ Text: Contact [email protected] or [email protected] for info.
OUTPUT
Match 1: [email protected] Match 2: [email protected]

Validating a date format (MM/DD/YYYY)

Quick check to see if user input matches the expected date shape. Not perfect validation, but catches obvious typos fast.

INPUT
Pattern: ^(0[1-9]|1[0-2])/(0[1-9]|[12]\d|3[01])/\d{4}$ Text: 03/25/2026
OUTPUT
Full match: 03/25/2026 Group 1: 03 Group 2: 25

Find-and-replace with capture groups

You need to reformat names from "Last, First" to "First Last" across a whole CSV column. Capture groups do the heavy lifting.

INPUT
Pattern: (\w+),\s*(\w+) Replace: $2 $1 Text: Smith, John Doe, Jane Garcia, Maria
OUTPUT
John Smith Jane Doe Maria Garcia

Who Uses This

👨‍💻 Developers

Testing input validation patterns before dropping them into production code.

📊 Data Analysts

Writing extraction patterns for messy log files and CSV cleanup scripts.

🎓 Students

Learning regex syntax with instant visual feedback instead of reading dry documentation.

🛠️ DevOps Engineers

Building log-parsing rules for Grafana, Datadog, or custom monitoring pipelines.

Common Mistakes

Forgetting to escape special characters

A dot . matches any character, not just a literal period. If you want an actual dot (like in an IP address or filename), write \. instead. Same goes for (, +, *, and other metacharacters.

Missing the global flag

Your pattern matches the first occurrence and then stops. You expected it to find all 15 matches in your text. Turn on the g flag — without it, the engine quits after the first hit.

Greedy quantifiers grabbing too much

The pattern <.+> on <b>bold</b> matches the whole thing — from the first < to the last >. Add a ? after the quantifier (<.+?>) to make it lazy. It will stop at the nearest closing bracket.

Anchors behaving differently in multiline mode

^ and $ match start/end of the entire string by default. If your test string has multiple lines and you want per-line matching, turn on the m (multiline) flag. Without it, only the very first and very last positions count.

Technical Details

Frequently Asked Questions

What is a regex tester and why do I need one?

A regex tester is a tool that runs your regular expression against sample text and shows you exactly what it matches. Writing regex without one is like coding without a debugger — you can do it, but you'll waste a lot of time guessing. The instant highlighting shows you problems the moment they happen, before your pattern ever touches production code.

Does this regex tester work with Python or PHP regex?

This tester uses JavaScript's RegExp engine (ECMAScript flavor). Most basic patterns — character classes, quantifiers, groups, lookaheads — work the same across languages. But some features differ: Python has named groups with (?P<name>) syntax, and PHP supports lookbehinds that JS didn't until recently. For 90% of patterns, what works here will work everywhere.

How do capture groups work in regex?

Parentheses () create capture groups. Whatever the pattern inside them matches gets saved separately, so you can reference it later — in replacements with $1, $2, or in code with match[1], match[2]. This tester shows each group's value in the match details section below the text panes.

What is the difference between greedy and lazy matching?

Greedy quantifiers (*, +, {n,}) grab as much text as possible and only give back characters when forced. Lazy versions (*?, +?) do the opposite — they match the minimum and expand only when needed. Try <.+> vs <.+?> on HTML tags in this tester and you'll see the difference immediately.

Is my data safe when I use this tool?

Yes. The entire tool runs in your browser using JavaScript. Your regex patterns and test strings are never sent to a server. Nothing is logged, stored, or transmitted. Close the tab and it is gone.

Share: