A Word Unscrambler guide

How to Find and Replace Text (with Regex)

Learn how find and replace works, the difference between literal and regex matching, and practical regex patterns for bulk text edits.

A find-and-replace tool searches your text for a target and swaps every match for replacement text. With plain text it handles simple renames and fixes; with regular expressions it becomes a powerful bulk-editing tool that can match patterns, not just fixed strings. This guide explains both modes and the regex patterns worth knowing.

Open the Find & Replace

What find and replace does

The tool scans your text for every occurrence of the search string and replaces it with the replacement string. In literal mode, the search string matches exactly — "cat" replaces only "cat", not "category". In regex mode, the search string is interpreted as a pattern that can match many different strings at once.

A case-sensitive toggle controls whether "Apple" and "apple" are treated as the same or different. Turn it on when case matters (code, proper nouns); turn it off for case-insensitive renames.

Literal versus regex matching

Use literal mode for straightforward substitutions: renaming a character, fixing a repeated typo, swapping a product name. Use regex mode when the targets vary — every phone number, every date, every URL — or when you want to match a pattern and keep part of it in the replacement.

Regex patterns worth knowing

A handful of patterns cover most bulk-editing jobs:

  • \d+ matches one or more digits — every number in the text. Replace with "#" to redact numbers, or capture and reformat them.
  • \b\w+\b matches a whole word. Use it to target words without catching substrings inside other words.
  • \bcat\b matches the whole word "cat" but not the "cat" in "category" or "concatenate".
  • \s{2,} matches two or more whitespace characters in a row — collapse them to a single space.
  • ^(.*)$ matches an entire line; use it with a captured group to wrap or reformat every line at once.
  • (\w+)@(\w+) matches an email-like pattern; capture groups let you rearrange the parts in the replacement.

Strategies for safe bulk edits

Bulk replacements are powerful and easy to over-apply. A few habits keep them safe:

  • Back up the original. Paste a copy somewhere safe before a large replace, so you can undo a mistake.
  • Test on a small sample first. Run the replace on a few lines and inspect the result before committing to the whole document.
  • Prefer word boundaries. \b prevents a replace from hitting substrings inside unrelated words.
  • Clean before you replace. Run the Text Cleaner first so spacing differences do not cause matches to fail.

Put it into practice

Try the Find & Replace

Ready to use what you just learned? Open the Find & Replace and put these strategies to work — instantly, privately, and free in your browser.

Back to the Find & Replace