Skip to main content
Tools Harbor

Find & Replace (with Regex)

Search and replace text using plain strings or regular expressions.

0 matches

Search and replace — with real regex power

Find and Replace is one of those tools you didn’t know you needed until the first time a text editor couldn’t handle your specific pattern. This version supports plain-string search for quick fixes and full JavaScript regular expressions for anything trickier.

What you can do

  • Strip whitespace — pattern \s+ with empty replacement collapses all runs of whitespace.
  • Mask sensitive data — pattern \b\d{16}\b with replacement ****-****-****-**** masks credit-card-like strings.
  • Reformat logs — pattern ^\[(\d{4}-\d{2}-\d{2})\] (.+)$ with replacement $1: $2 reformats dated log lines.
  • Swap word order — pattern (\w+), (\w+) with replacement $2 $1 flips “last, first” to “first last”.
  • Normalize casing on matches — pair this with the Case Converter for multi-step transformations.

Flags supported

  • Global (g) is always on. Every occurrence is replaced.
  • Case-insensitive (i) — toggle to ignore letter case.
  • Multiline (m) — toggle to make ^ and $ match at line breaks.

Privacy

Everything happens in your browser. The input, the pattern and the result never leave your device.

Frequently asked questions

What is the difference between plain and regex mode?
Plain mode searches for the exact string you enter, including any punctuation. Regex mode interprets the input as a JavaScript regular expression, letting you match patterns, use groups, and refer back to them in the replacement.
Can I use backreferences in the replacement?
Yes. In regex mode, use `$1`, `$2`, etc., to insert captured groups from the pattern. For example, pattern `(\w+)@(\w+)` with replacement `$2/$1` swaps the two halves around an "@" sign.
What does multiline mode do?
When multiline is enabled, the `^` and `$` anchors match at the start and end of each line instead of only the start and end of the whole input.