Skip to content
Find & Replace

Find & Replace

Find & replace with full regex support: $1 capture groups, case and whole-word options.

literal · $1 and $& are not expanded
Regex cheatsheet
\dany digit 0-9\d+ matches 2026
\wletter, digit or underscore\w+ matches hello_42
.any character except newlinec.t matches cat, cut
*zero or more of the previouslo*l matches ll, lool
+one or more of the previousgo+d matches god, goood
?previous item is optionalcolou?r matches color, colour
^start of the text^The matches a leading The
$end of the textend$ matches a trailing end
()capture group, use $1 in Replace(\w+)@(\w+) with $2.$1
[]any one character from a set[aeiou] matches any vowel

This find and replace tool runs entirely in your browser. Nothing you paste is uploaded anywhere. Turn on regex mode and it goes well beyond a basic text swap: full JavaScript regular expressions with $1-style capture-group backreferences, named groups, whole-word matching, case control, and a live count of how many spots changed.

How to use

  1. Paste or type your source text into the Input panel, or use the Paste, Sample, and Clear buttons in its header.
  2. Fill in Find and Replace with. The result updates as you type, and the count above the result panel tells you how many replacements were made.
  3. Toggle Regex, Match case, or Whole word as needed. The Regex cheatsheet under the toolbar lists the most common pattern tokens with examples.
  4. Click Copy to grab the result, or Download to save it as a text file.

Capture groups: a worked example

Each pair of parentheses in a regex saves whatever it matched, and you can paste those pieces back into the replacement with $1, $2, and so on. Say you want to flip user/domain pairs around: turn on Regex, set Find to (\w+)@(\w+) and Replace with to $2.$1. This input:

alice@wonderland
bob@builder

becomes:

wonderland.alice
builder.bob

Here $1 holds the part before the @ and $2 the part after, so $2.$1 swaps them with a dot in between. Also supported: $& for the entire match (handy for wrapping, e.g. **$&**), $<name> for named groups like (?<year>\d\d\d\d), and $$ for a literal dollar sign.

Edge cases and notes

  • Whole word wraps your pattern in word boundaries as \b(?:pattern)\b. The non-capturing group means an alternation like cat|dog is treated as one unit, and your $1, $2 numbering is not shifted by the wrapper.
  • Match case is off by default, so searching for the also hits The and THE. Turn it on for exact-case matching.
  • With Regex off, both fields are plain text: special characters like . and * are matched literally, and $1 in the replacement is inserted literally rather than expanded.
  • An invalid pattern (say, an unclosed bracket) shows the parser error in the result panel instead of failing silently.

FAQ

More questions? Browse the full FAQ.

Want to pull the matches out of the text instead of replacing them? Use the pattern extractor to list emails, URLs, or custom regex matches. And to double-check exactly what changed, paste the before and after into the text diff tool for a line-by-line comparison.

Search tools

Search all Textbench tools