Text Replacer

Text

Find and replace text with case-sensitive, whole-word and regex matching. Replace all at once with live preview, and review every hit before applying.

Waiting for input
Input
0 lines
Result
0 lines

About Text Replacer

This find-and-replace tool supports plain text, case-sensitive, whole-word, and JavaScript regex modes. Regex accepts g/i/m/s/u/y flags with backreferences ($1-$9) for dynamic substitution and multiline text with Unicode property matching. All matching runs locally via String.prototype.replace and the native RegExp engine - nothing is uploaded, so sensitive logs and code stay on your device, and a live preview with a match count lets you confirm before copying. Replacement is easier to get wrong than search, so a few guardrails help: whole-word mode uses word-boundary assertions, so swapping Hello for Hi will not clobber concatenated words like HelloWorld; regex metacharacters (. * + ?) are not literal and must be escaped as intended; and greedy matching consumes as much as possible, so append ? for the minimal match. Test against a small sample and verify the match count before running a full replacement, and keep a backup of the original. For complex multiline edits, combine the global and multiline flags, work in chunks, and cross-check the result against the source afterward. For example, replace every Hello with Hi using whole-word mode to avoid touching HelloWorld.

How to Use

  1. Open the Text Replacer tool
  2. Paste the text to process
  3. Adjust the output options as needed
  4. Click the Process button; results appear in real time
  5. Copy or export the result

Use Cases

  • Rename variables in bulk — Globally replace old identifiers during code refactoring; whole-word mode prevents substring matches.
  • Log redaction — Use regex to match phone numbers and ID numbers, replacing them with asterisk masks in log files.
  • Config file updates — Batch-replace environment URLs, ports, and key placeholders in YAML or JSON configs.
  • Template placeholder fill — Replace mustache-style template variables with actual values using capture-group backreferences.
  • Normalize whitespace — Unify Windows and Unix line endings, or trim leading and trailing spaces from each line.
  • Normalize date formats — Use regex to reformat differently written dates into one consistent format for reliable sorting.

FAQ

Does it support regex replacement?

Yes. Switch to regex mode to enter patterns and use $1 backreferences for dynamic substitution, compatible with g/i/m/s/u flags.

What is the difference between whole-word and normal matching?

Whole-word matching uses word-boundary assertions, so replacing cat will not match category or scatter, ideal for precise identifier replacement.

Can a bad regex replace too much?

Yes. Greedy matching consumes as much as possible, and unescaped metacharacters like . * + ? act as wildcards; preview on real samples and back up first.

Can I preview replacements in real time?

Yes. The output area refreshes instantly with a match count each time you change the matching criteria, so you can confirm before copying.

Does it handle multiline text?

Yes. With the m flag, ^ and $ match the start and end of each line; the s flag makes the dot match newline characters.

Is my data uploaded to a server?

No. All matching and replacement runs locally in the browser via the RegExp engine with no network requests, safe for sensitive content.

Advertisement