To find and replace multiple words at once, you need either a chain of replacements that runs in sequence, a single regex that matches several words when they share the same replacement, or a tool that holds a list of find and replace rules and applies them in order in one pass. A normal find and replace box handles one pair at a time, so repeating it twenty times across hundreds of files is slow and easy to get wrong.
This guide shows each approach, explains why rule order matters, and covers the traps that appear when you replace many terms together.
Approach 1: one regex for several words
If several different words should all become the same thing, one regular expression can do it. Use alternation with the | character:
\b(Acme Corp|AcmeCorp|ACME Inc)\b → Acme Corporation
The \b word boundaries stop the pattern matching inside longer words, and the group keeps the alternatives together. This works in any regex-capable tool: PowerShell -replace, VS Code, Notepad++ in Regular expression mode, and batch tools.
If each word needs a different replacement, a single regex is not enough. You need a list of separate rules.
Approach 2: chain replacements in PowerShell
PowerShell lets you chain the -replace operator. Each one runs on the result of the previous one:
$n = $t -replace '\bAcme Widgets\b','Acme Tools' -replace '\bwidget\b','tool' -replace '\bWidgetPro\b','ToolPro'
Wrapped in a file loop, that looks like:
Get-ChildItem -Recurse -File -Filter *.md | ForEach-Object { $t = Get-Content $_.FullName -Raw -Encoding UTF8; $n = $t -replace 'a','b' -replace 'c','d'; if ($n -ne $t) { Set-Content $_.FullName $n -NoNewline -Encoding UTF8 } }
Remember that -replace is a regex and ignores case. For literal, case-sensitive replacements use .Replace() calls in a row instead: $t.Replace('a','b').Replace('c','d'). For a long list, keep the pairs in a CSV and loop through them, as shown in our guide to bulk find and replace from a list.
Approach 3: an editor, one pass per word
VS Code and Notepad++ replace one search term at a time. For three or four words that is fine: run the replace, change the terms, run it again. For more than that, the repetition becomes the risk. It is easy to skip a term, mistype one, or run them in the wrong order.
Approach 4: stacked rules in one pass
A batch tool with a rule list removes the repetition. In Bulk Replace you stack as many find and replace rules as you need, and they run in order during a single pass over the files:
- Choose the folder, include sub-folders if needed, and set extension filters.
- Add each rule. Every rule can be plain text, wildcard or regex, with its own case-sensitive and whole-word settings.
- Or import the whole list from a CSV, which is ideal for glossaries and brand-name migrations.
- Check the preview. It shows the combined effect of all rules on every file, with a total match count.
- Untick anything you want to leave alone, then apply. Files are backed up first and one click undoes the run.
In Bulk Replace, saving the folder, filters and rules as a named project means you can run the same set again later, for example on next month's new files.
Why rule order matters
When replacements run one after another, each rule sees the text after the earlier rules changed it. That causes two classic problems.
Problem 1: a short term breaks a long term
Suppose your rules are:
Acme→ZenithAcme Widgets→Zenith Tools
Rule 1 runs first and changes Acme Widgets into Zenith Widgets. Rule 2 then finds nothing, because Acme Widgets no longer exists. The fix is to put longer, more specific terms first:
Acme Widgets→Zenith ToolsAcme→Zenith
Problem 2: swapping two words
To swap left and right, two plain rules do not work: the first turns every left into right, and the second then turns all of them, old and new, into left. Use a temporary placeholder that never appears in your files:
left→@@TMP@@right→left@@TMP@@→right
Search for the placeholder first to make sure it is not already in any file.
Other traps with many replacements
| Trap | Example | Fix |
|---|---|---|
| Partial matches | cat → dog also changes category | Use whole-word matching or \b |
| Case variants missed | Widget changed but WIDGET left | Add rules for each case, or ignore case if the replacement case does not matter |
| Plurals | widgets becomes toolss or is missed | Add plural rules first, or use widget(s?) → tool$1 |
| Rules undoing each other | A → B, then B → A | Use a placeholder, or review the order |
| Changing code you did not mean to | A term that is also a variable name | Filter by extension and review the preview |
Whole-word matching deserves its own explanation, including where it fails with hyphens and symbols. See find and replace whole word only.
Which approach should you use?
| Situation | Best approach |
|---|---|
| Several spellings should all become one word | One regex with alternation |
| Two or three different pairs, one-off job | Repeat the editor replace, or chain them in PowerShell |
| Ten or more pairs, or a list someone maintains in Excel | CSV list applied by a loop or imported as rules |
| A job you will repeat on new files | Saved rule set or saved project |
| Changes you must be able to review and reverse | Stacked rules with preview and backups |
Mixing approaches is fine. A rule list can include a regex rule for spelling variants alongside plain-text rules for each product name, as long as the order is right.
Mixing plain-text and regex rules
Plain-text rules are the safest default because nothing in them has a special meaning. Switch a single rule to regex only when it needs a pattern, such as optional plurals, word boundaries or alternatives. Keep regex rules near the top of the list if they are broad, so that later plain-text rules see consistent text, or near the bottom if they tidy up what earlier rules produced. Either way, decide on purpose and check the result in a preview.
Testing a long list safely
- Copy two or three representative files to a test folder.
- Run the full rule list on the test folder only.
- Open the results and check every term, especially ones that overlap.
- Search the output for the old terms. Anything still there points to a rule that did not run, or ran in the wrong order.
- Run the list on the real folder, keeping a backup.
With the list in order and tested, replacing fifty terms across a thousand files takes about as long as replacing one.
If you are updating names across documentation in particular, our guide on updating terminology across documentation covers glossaries, case and plurals in more depth.
Frequently asked questions
Can one find and replace change several different words?
A single plain-text replace changes one string. To change several, chain replacements, use a regex alternation for words that share one replacement, or use a tool that runs a list of rules in order.
Does the order of replacement rules matter?
Yes. Rules run one after another, so an early rule can create text that a later rule then matches. Put longer, more specific terms first.
How many replacements can I run at once?
With a rule-based batch tool there is usually no practical limit. In PowerShell you can chain as many -replace operators as you like, but long chains get hard to read and test.
