~/regex-tester apps ← about me
🔒 100% client-side · Your data never leaves this browser · No upload · No server
 ██████╗ ███████╗ ██████╗ ███████╗██╗  ██╗
 ██╔══██╗██╔════╝██╔════╝ ██╔════╝╚██╗██╔╝
 ██████╔╝█████╗  ██║  ███╗█████╗   ╚███╔╝
 ██╔══██╗██╔══╝  ██║   ██║██╔══╝   ██╔██╗
 ██║  ██║███████╗╚██████╔╝███████╗██╔╝ ██╗
 ╚═╝  ╚═╝╚══════╝ ╚═════╝ ╚══════╝╚═╝  ╚═╝
Write a regex · See matches highlighted live · Explore capture groups & replacements
0
Matches
0
Groups
0
Chars matched
0ms
Exec time
⚙ Pattern
/ /
flags
📄 Test String
🎨 Match Output
Type a pattern and test string to see live matches
.any character
\ddigit [0-9]
\Dnon-digit
\wword char [a-zA-Z0-9_]
\Wnon-word char
\swhitespace
\Snon-whitespace
\bword boundary
^start of string/line
$end of string/line
*0 or more
+1 or more
?0 or 1
{n}exactly n
{n,m}between n and m
()capture group
(?:)non-capture group
(?=)positive lookahead
(?!)negative lookahead
(?<=)positive lookbehind
(?<!)negative lookbehind
[abc]char class
[^abc]negated char class
|alternation (or)

Regex Tester — frequently asked questions

grep
Basics
What does this regex tester do?

It lets you write a regular expression and instantly see all matches highlighted in your test string. You get live stats, capture group details, index positions, and can also test replacements.

Is my data uploaded anywhere?

No, never. The entire tool runs in JavaScript inside your browser. No data is sent to any server. You can verify this in your browser's network tab.

Which regex flavour is used?

JavaScript (ECMAScript) regular expressions. This is the same engine used in modern browsers, Node.js, Deno, and Bun. Named groups, lookbehinds, and Unicode property escapes are supported.

Can I use flags like global or case-insensitive?

Yes. Toggle the g (global), i (case-insensitive), m (multiline), s (dotAll), and u (unicode) flags with the buttons above the pattern input. The regex is re-evaluated instantly.

What does the g flag actually change?

Without g, JavaScript stops after the first match. With g toggled on, this tool finds every match in the test string and lists them all in the details table. Turning g off is useful when you only care whether a pattern matches at all, or want to inspect the very first match closely.

Groups & syntax
How do capture groups work?

Wrap part of your pattern in parentheses () to create a capture group. The match details table below the output shows each group's value and index. Groups are colour-coded in the output.

What's the difference between capturing and non-capturing groups?

Parentheses (...) create a capturing group — its match is numbered ($1, $2...) and shows up in the details table. Prefix with ?:(?:...) — for a non-capturing group: it still groups the pattern for quantifiers or alternation, but doesn't produce a numbered result. Use non-capturing groups to keep your group numbering clean when you don't need a piece of text back.

Can I name my capture groups, and use the names in a replacement?

Yes. Write (?<name>...) to create a named group — its value appears alongside the numbered groups in the match details table. In the replacement field, reference it with $<name> instead of $1, $2, etc.

What's the difference between greedy and lazy quantifiers?

A greedy quantifier like *, +, or {2,5} matches as much as it possibly can, then backtracks only if needed. Adding a ?*?, +?, {2,5}? — makes it lazy, matching as little as possible instead. Click Explain above the pattern input to see each quantifier in your own pattern labelled greedy or lazy.

What is a word boundary (\b), and when should I use it?

\b matches the invisible position between a word character (letter, digit, underscore) and a non-word character — without consuming any text itself. It's what makes \bcat\b match the whole word "cat" but not "category" or "scatter". Use \B for the opposite: a position that is not a word boundary.

How do I match a literal special character like . or *?

Escape it with a backslash: \. matches a literal period, \* a literal asterisk, and so on for \ ^ $ . | ? * + ( ) [ ] { }. Inside a character class ([...]) most of these lose their special meaning already, so [.] is equivalent to \..

Do you support Unicode property escapes like \p{Emoji}?

Yes — toggle the u (unicode) flag, then patterns like \p{Letter}, \p{Script=Greek}, or \p{Emoji} work as in any modern JavaScript engine. Without the u flag, \p{...} is treated as a literal, not a Unicode property escape.

Power features
Can I test replacements?

Yes. Type a replacement string in the replacement input below the pattern. Use $1, $2 etc. to reference capture groups, or $& for the full match. The replaced output appears live.

Can it explain what my regex means?

Yes. Click Explain above the pattern input for a plain-English, line-by-line breakdown of every anchor, character class, quantifier, group, and lookaround in your pattern — handy for untangling a pattern someone else wrote.

What happens if my regex is slow or catastrophic?

Matching runs off the main thread in a Web Worker with a hard timeout, so a runaway pattern can't freeze the page. Patterns with tell-tale signs of catastrophic backtracking (nested repeating groups) get a warning up front, and anything that takes too long is aborted automatically.

Does it remember my previous patterns?

Yes. Open the History tab to see recently tested patterns, saved only in your browser's local storage. Click one to restore its pattern, flags, and test string, or clear the list anytime.

Can I export my regex as code?

Yes. Choose a language — JavaScript, Python, PHP, Java, Go, or Ruby — from the dropdown below the match output and click Copy as code to get a ready-to-paste snippet using that language's native regex syntax.

Can I jump between matches or see line/column positions?

Yes. Use the Prev/Next buttons (or F3 / Shift+F3) above the match output to step through matches one at a time — the current match is outlined in the highlighted text. The match details table also shows each match's line and column position, not just its character index.

Can I share my regex or link directly to one?

Click the Share link button to copy a URL that encodes your pattern, flags, and test string — and the address bar stays in sync as you edit. You (or an AI assistant) can also build a deep link by hand: ?pattern=\d+&flags=g&test=abc123. Supported parameters are pattern (alias regex/r), flags (f), test (input/t), and replace (replacement/rep). Anyone who opens the link sees the same setup.

Is there a keyboard shortcut to run the match?

The pattern re-evaluates automatically as you type (lightly debounced). If you want to force an immediate re-match, press Ctrl+Enter (or Cmd+Enter on Mac). Use F3 / Shift+F3 to jump to the next or previous match.

Troubleshooting & compatibility
Why doesn't my regex match across multiple lines?

By default, . does not match newline characters, and ^/$ only match the very start/end of the whole string. Toggle the s (dotAll) flag so . also matches newlines, or the m (multiline) flag so ^/$ match the start/end of each line instead.

Is this a good way to validate emails or passwords?

It's a great way to prototype and test the pattern, but be cautious about using it as a real-world validator: a fully RFC-compliant email regex is notoriously complex, and password rules are usually better expressed as several small checks (length, character classes) than one giant pattern. Always validate again on the server — client-side regex checks can be bypassed entirely.

Does JavaScript regex work the same as Python or PCRE regex?

Mostly, but not identically. JavaScript lacks some PCRE features (possessive quantifiers, recursive patterns, inline verbose/comment mode) and has its own flag system (g, u, d, etc). Named groups, lookaheads and lookbehinds, and most character classes behave the same way. When porting a pattern from another language, re-test it here rather than assuming it will behave identically.

Does this work the same in every browser?

Yes — this tool relies only on the standard JavaScript RegExp engine and Web Worker API, both supported in all current versions of Chrome, Firefox, Safari, and Edge. Very old browsers may not support newer syntax like named groups, lookbehinds, or \p{...} property escapes even if the tool itself loads fine.