Find and Replace (Regex)
How it works
The pattern runs as a standard JavaScript regular expression (new RegExp(pattern, flags)),
and the replacement runs through String.replace, so its native syntax — $1,
$2 for capture groups, $& for the whole match, $$ for a
literal dollar sign — works automatically, nothing reimplemented here. The match count shown below
is always computed with the g flag added, regardless of whether your own flags include
it, so you can see how many matches exist even when only replacing the first one.
Frequently asked questions
How do capture-group references work in the replacement field?
$1, $2, and so on refer to numbered capture groups from the pattern — (\w+) (\w+) with a replacement of $2 $1 swaps two words. $& refers to the whole match, and $$ inserts a literal dollar sign. This is standard JavaScript String.replace syntax, not a custom scheme invented for this tool.
How is this different from the Regex Tester?
The Regex Tester shows you WHERE a pattern matches — each match, its position, its capture groups — without changing anything. This tool actually performs the substitution: it runs the same kind of pattern against your text and hands back the transformed result, along with how many matches were found.
What happens if I enter an invalid pattern?
You get a clear error naming the syntax problem — an unbalanced parenthesis, a bad character class, and so on — rather than a silent no-op or a broken result.