Regex Tester & Debugger

Write, test, and debug regular expressions with real-time match highlighting, capture groups, and replacement preview. All in your browser.

0 matches

Highlighted Matches

Enter a test string to see matches

Match Details

No matches found.

Quick Reference

Anchors

^Start of string
$End of string
\bWord boundary
\BNon-word boundary

Quantifiers

*0 or more
+1 or more
?0 or 1
{n,m}n to m

Character Classes

.Any char
\dDigit
\wWord char
\sWhitespace
[abc]One of a,b,c

Groups

(...)Capturing
(?:...)Non-capturing
(?<N>...)Named
(?=...)Positive lookahead

Escapes

\nNewline
\tTab
\.Literal .
\*Literal *

Flags

gGlobal
iIgnore case
mMultiline (^/$ match each line)
sDotAll (. matches newlines)
uUnicode
ySticky (match from lastIndex)
dIndices (capture start/end positions)

Real-time matching

Matches highlight instantly as you type. See match count, positions, and lengths without pressing a button.

Capture groups & named groups

Inspect numbered $1–$9 capture groups and (?<name>...) named groups. Click any match to expand details.

Replace preview + presets

Preview find-and-replace with $&, $1, $<name> variables. Load preset patterns for emails, URLs, IPs, dates, and more.

How to use the Regex Tester

Enter your pattern in the Regular Expression field. Toggle flags to change matching behavior — global (g) finds every occurrence, ignore case (i) makes it case-insensitive, multiline (m) lets ^ and $ match each line, and dotAll (s) makes the dot match newlines. Paste your text into the Test String area and watch matches highlight in real time. Click any match to expand its capture groups. Switch on Replace mode to preview substitutions.

Regex flags explained

g (global): find all matches, not just the first.
i (ignore case): A matches a.
m (multiline): ^ and $ match start/end of each line.
s (dotAll): . matches \n (newlines).
u (unicode): enables \p{...} and proper surrogate pair handling.
y (sticky): match only from lastIndex (useful for tokenizers).
d (indices): include start/end indices for each match.

Common use cases

Validate email addresses, parse URLs, extract phone numbers, sanitize form inputs, tokenize log files, find credit card numbers for PCI scans, validate date formats, and search codebases. The presets menu loads popular patterns instantly so you can tweak them for your exact needs.

Frequently asked questions

What is a regex tester?

A regex tester is an interactive tool that lets you write a regular expression, choose flags, and instantly see which parts of a test string match. It highlights matches, shows capture groups, and supports find-and-replace previews — all in your browser.

Is my data sent to a server?

No. All regex matching runs locally in your browser using JavaScript's native RegExp engine. Your patterns and test strings never leave your device.

What regex flavor does this tool use?

ECMAScript (JavaScript) regular expressions. This supports modern features like named capture groups (?<name>...), Unicode property escapes (\p{...}), lookaheads/lookbehinds, and the dotAll (s) and sticky (y) flags.

What do the flags mean?

g = global (find all matches, not just the first). i = ignore case. m = multiline (^ and $ match each line). s = dotAll (. matches newlines). u = Unicode mode. y = sticky (match only from lastIndex). d = provide match indices.

How do capture groups work?

Parentheses (...) create capturing groups. $1, $2, etc. refer to them in replacements. (?:...) is non-capturing — useful for grouping without saving. (?<name>...) creates a named group accessible as $<name>.

What is a lookahead / lookbehind?

Lookaheads and lookbehinds assert that a pattern is (or isn't) present without consuming characters. (?=...) is a positive lookahead; (?!...) is negative. (?<=...) and (?<!...) are lookbehinds (fixed-width in JS).

Why does my pattern say 'Invalid regular expression'?

Common causes: unescaped special characters (., *, +, ?, etc.), mismatched parentheses, an invalid quantifier, or using a feature not supported by your browser's JS engine. The tool shows the error immediately so you can fix it.

What are the replacement special variables?

$& inserts the matched substring. $1–$9 insert capture groups. $` inserts the text before the match. $' inserts the text after. $$ inserts a literal dollar sign. Named groups use $<name>.

Can I test regex for Python / PHP / Java / Go?

This tool uses JavaScript regex syntax. Most basics are the same across languages, but there are differences: Python supports variable-width lookbehinds; PCRE has different escape rules; Java and Go have different Unicode handling. Use this tool to prototype, then verify in your target language.

What is the difference between greedy and lazy quantifiers?

Greedy quantifiers (*, +, {n,}) match as much as possible. Lazy quantifiers (*?, +?, {n,}?) match as little as possible. Example: <.+> on '<a><b>' greedily matches the whole string; <.+?> lazily matches each tag separately.

Part of our growing tool belt — all client-side, all free.