Overview
Introduction
Replacing a word throughout a document sounds simple until a generic find-and-replace also mangles that word's substring inside unrelated longer words, which is exactly what whole-word matching avoids.
This tool runs entirely client-side, so nothing you paste is ever uploaded to a server.
What Is Word Replacer?
A word replacer that swaps every case-insensitive, whole-word match of a target word for a replacement word, using word-boundary matching so it never touches part of a longer word.
It's distinct from this site's generic find-and-replace tool, which does plain substring replacement and would match a target word anywhere it appears, even inside other words.
How Word Replacer Works
The tool builds a case-insensitive regular expression from the target word wrapped in word-boundary markers, escaping any regex-special characters in the target first.
It then replaces every match in the input with the replacement text, leaving all surrounding punctuation and spacing exactly as it was.
When To Use Word Replacer
Use it when renaming a term throughout a document, swapping a placeholder name for a real one, or correcting a consistently misused word, without risking a partial match inside an unrelated longer word.
It's a fast way to get the answer without opening a code editor, a REPL, or writing a one-off script just to check.
Often used alongside Find & Replace Tool, Word Remover and Case Converter.
Features
Advantages
- Whole-word matching avoids accidentally replacing part of a longer, unrelated word.
- Case-insensitive matching catches capitalized and lowercase occurrences alike.
- Escapes the target before building the pattern, so a word containing punctuation is matched literally rather than being read as regex syntax.
Limitations
- The replacement text is inserted verbatim; it doesn't automatically match the original word's capitalization.
- Only a single target/replacement pair can be set at a time.
Examples
Best Practices & Notes
Best Practices
- Check the replacement's capitalization afterward, since it's inserted exactly as typed rather than matched to the original word's case.
- Use the generic find-and-replace tool instead if you actually want substring matching.
- Run once per capitalization when the replacement needs to match the original's case, since the replacement is inserted exactly as you typed it.
Developer Notes
The target word is escaped for regex special characters and wrapped as `new RegExp(\`\\b${escaped}\\b\`, "gi")`, so `\b` word-boundary assertions are what prevent matches inside longer words like "category".
Word Replacer Use Cases
- Renaming a term consistently throughout a document
- Swapping a placeholder name for a real one before publishing
- Correcting a specific misused word without touching similar longer words
Common Mistakes
- Reaching for this tool expecting substring matching; use the generic find-and-replace tool for that instead.
- Assuming the replacement word inherits the matched word's capitalization; it doesn't.
Tips
- Combine with a word remover tool if you want to replace some occurrences and delete others in separate passes.
- Word boundaries treat an apostrophe as a break, so a possessive like "cat's" becomes "dog's" automatically rather than being skipped.