RegexLab

$ regex-tester --mode=live --lang=en

Test & debug regular expressions.

A fast regex tester with live match highlighting, capture groups, a replace preview, inline explanations and a library of ready-made patterns. Free, offline and private.

Instant, no sign-up100% in your browserWorks offline
Pattern library
//
Valid · 2 matches
Matches · 2
#1alice@example.com@0
#2bob@test.org@18
Replace / substitution


invalid-email
2024-01-15
https://example.com
Explanation
[a-zA-Z0-9._%+\-]Character class: one of [a-zA-Z0-9._%+\-]
+One or more of preceding
[a-zA-Z0-9.\-]Character class: one of [a-zA-Z0-9.\-]
+One or more of preceding
\.Escaped: .
[a-zA-Z]Character class: one of [a-zA-Z]
{2,}2 or more times

Why RegexLab

Live match highlighting

Every match lights up in your test string as you type, with capture groups, positions and a running count — no run button, no waiting.

Replace & explain

Preview a substitution with $1/$2 backreferences, and read a plain-language breakdown of what every token in your pattern does.

Private by default

The engine is your browser's native RegExp. Nothing is uploaded, nothing is tracked — your patterns and text never leave the page.

English & Russian

The whole site — the tester, guides and help — is fully bilingual. Switch languages anytime from the header.

Regular expressions, made approachable

RegexLab is a free online regular-expression tester built for the moments when you need to know, right now, whether a pattern actually matches. Paste your text, type a pattern, toggle the g/i/m/s/u/y flags, and every match is highlighted instantly with its capture groups and character offsets. A live replace preview shows what a substitution would produce, and an inline explanation breaks the pattern into plain-language tokens so you learn as you go.

Everything runs client-side in your browser on the native JavaScript RegExp engine, so it is fast, private and works offline once loaded. There is nothing to install and no sign-up. Whether you are validating an email field, extracting values from a log file, cleaning up messy data or just learning how lookahead works, the tester and its library of ready-made patterns are one keystroke away — and each guide explains the syntax behind them.

Guides & articles

Plain-language explainers on regex syntax, flags and the patterns you reach for most.

Read more guides

Frequently asked questions

What is a regular expression and why would I use one?+

A regular expression is a compact pattern that describes text — for example \d{4}-\d{2}-\d{2} for an ISO date. Instead of writing loops that inspect characters one by one, you describe the shape you want and let the engine find, validate or replace matching text. It is the fastest way to search, clean and extract data across editors, code and command-line tools.

What is the difference between greedy and lazy quantifiers?+

By default quantifiers like * and + are greedy: they consume as much text as possible, then give some back until the rest of the pattern fits. Adding a ? makes them lazy, matching as little as possible. Against <b>a</b><b>b</b>, the pattern <b>.*</b> greedily matches the whole string, while <b>.*?</b> matches just the first <b>a</b>. Choosing correctly is often what makes a pattern behave.

How do capture groups and named groups work?+

Parentheses capture the text they match, numbered left to right, so (\d{4})-(\d{2}) puts the year in group 1 and the month in group 2. You can name them for clarity with (?<year>\d{4}), then read match.groups.year. Use (?:...) when you need grouping without a capture, and reuse captures in a replacement as $1, $2 or $<year>.

What are lookahead and lookbehind?+

They are assertions that check the context around a position without consuming characters. Positive lookahead (?=...) and negative lookahead (?!...) test what follows; positive lookbehind (?<=...) and negative lookbehind (?<!...) test what precedes. For example \d+(?=px) matches a number only when px follows, and (?<=\$)\d+ matches an amount only after a dollar sign — in both cases without including the context in the match.

What does the /g flag do, and which flags does RegexLab support?+

The global flag g tells the engine to find every match rather than stopping at the first, which is what you want for replace-all and match loops. RegexLab supports all six JavaScript flags: g (global), i (ignore case), m (multiline, so ^ and $ match line breaks), s (dotAll, so . matches newlines), u (unicode) and y (sticky). Toggle any of them beside the pattern to see the matches update instantly.

Why does my regex work in Python but not in JavaScript?+

Regex dialects differ in small but important ways. Named groups use (?P<name>...) in Python versus (?<name>...) in JavaScript and Java. Some Python features, such as certain inline flags or the \A and \Z anchors, have no direct JavaScript equivalent. RegexLab uses your browser's native JavaScript RegExp engine, so test patterns here in the same dialect your JavaScript code will run.

Can I use RegexLab to replace or reformat text?+

Yes. Type a pattern, then enter a replacement in the replace box using $1, $2 or $<name> to reuse captured groups. The result updates live and there is a button to copy it. For example, matching (\d{4})-(\d{2})-(\d{2}) and replacing with $3/$2/$1 turns 2026-08-22 into 22/08/2026.

Is my data sent anywhere?+

No. Every match runs locally in your browser using the native RegExp engine. Your patterns and test text never leave your device and nothing is stored on a server, so you can safely paste sensitive logs or sample data. Once the page has loaded it also works offline.