Build a JavaScript RegExp, toggle flags, and watch matches highlight in your subject text. See every match index
and capture group, preview replace with $1 / $& — all evaluated locally in your browser.
String.prototype.replace — supports $&, $1…$9, $`, $', $$.(Enter a replacement string to preview substitution.)
A regular expression (regex) is a pattern language for searching and transforming text: character classes, quantifiers, anchors, groups, and
backreferences. In browsers and Node.js, patterns compile to JavaScript’s RegExp object (ECMAScript semantics). The same engine is used
by String.prototype.match, replace, and split — so this tool is useful for quickly tuning patterns before you paste them into
Kotlin, TypeScript, or grep-like tools (keeping in mind flavor differences).
DroidXP’s Regex Tester builds a new RegExp(pattern, flags) from your inputs. When the pattern is valid, it runs exec in a loop (for
global patterns) or once (non-global), collects start indices, full matches, and capturing groups, and renders the subject with
highlighted spans. The optional replacement field previews String.prototype.replace output — including
$1 / $& substitution rules. Nothing is sent to a server; your strings stay in the tab.
This page uses JavaScript (ECMAScript) regexes. PCRE, POSIX, or Python regex libraries differ in advanced features (lookbehind breadth, atomic groups, recursion). For production Android or server code, verify the same pattern in your target runtime.
No. Matching runs entirely in your browser. Avoid pasting production secrets into any online tool unless policy allows.
g) flag?
Without g, JavaScript’s non-global regex stops after the first match. Turn on g to iterate all matches in the subject (and to drive
replace-all behavior with replace).
Catastrophic backtracking on nested quantifiers can make regex evaluation exponential. If the tab hangs, simplify the pattern, use atomic groups in engines that support them, or test in smaller steps. This tool caps iteration to protect the UI.
re.sub?
Replace uses JavaScript’s rules: $n for captures, $& for the whole match, $$ for a literal dollar. Other languages use
different syntax (e.g. \1 in some sed dialects).
Modern JavaScript supports lookbehind in compatible engines, but older browsers may not. If a pattern fails to compile, check browser support or simplify the assertion.
The subject is JavaScript text (UTF-16). Binary or legacy encodings should be converted before testing here.
It is a quick interactive aid. For security-sensitive validation (e.g. allowlists), combine with automated tests, lint rules, and review — never rely on a single browser check.