Wildcard Find and Replace in Word: How to Change What You Find

Finding all mistakes in a document that fall into a particular pattern is useful. Being able to automatically fix them at the same time is transformative.

Wildcards are usually introduced as a way to find things. But finding is only half the story. With wildcard Find and Replace in Word, you can search for a pattern and replace it, too. The Replace With field lets you specify what should take its place.

Used together, wildcards stop being merely a clever way to locate problems and become a way to fix several hundred at once.

Three Things You Can Do with Word Wildcard Find and Replace

  1. Delete a whole category of thing. Write a pattern that describes every editorial placeholder your author left behind, leave the Replace With field completely empty, and they all vanish in one pass.

  2. Replace something with itself. This sounds like the most pointless operation in software history, and it is quietly one of the most useful. Take accommodation: should it be one c or two, one m or two? The string ac{1,2}om{1,2}odation finds every combination of that mistake. Replace the matches with accommodation and they’re all corrected. Yes, it also finds the correctly spelled version and replaces it with itself. That costs you nothing, but it’s still a software quirk we like to point out.

  3. Correct a long phrase however it’s been mangled. The same principle scales. A string built to allow for a missing the, a missing hyphen, a lowercase letter, a stray plural, and a missing serial comma can catch any combination of those errors in a long organization name. Five possible mistakes give you thirty-one variations, all corrected by one search.

 

Parentheses: Recalling What You Found

Here’s the problem. You want to find every four-digit decade written with an apostrophe, such as 1940’s, 1800’s, or 2010’s, and remove the apostrophe. What do you put in the Replace field? The answer changes every time.

Parentheses solve it. They create what Word calls expressions: wrap part of the Find string in parentheses, and that portion becomes available in the replacement. Recall it with a backslash and a number.

Find:     <([0-9]{4})[’']s>

Replace:  \1s

The Find string says “four digits, then an apostrophe, then an s.” The Replace string says “whatever those four digits were, then an s.” And just like that, every decade is corrected in one go. Notice that the apostrophe set catches both straight and curly versions.

Expressions are numbered from left to right, so \1 is the first, \2 the second, and so on.

 

Two Examples Worth Stealing

1. Closing Up a Prefix Without Breaking the Exceptions

Find:     <([Aa]nti)-([!i][a-z]@)>

Replace:  \1\2

This turns anti-social into antisocial and Anti-freeze into Antifreeze. The hyphen sits outside both sets of parentheses, so it simply disappears. The [!i] protects anti-inflammatory and anti-intellectual, which keep their hyphens. And [Aa] means the capitalization survives untouched.

2. Swapping Date Formats

Find: ([0-9]{1,2})/([0-9]{1,2})/([0-9]{2,4})

Replace: \2/\1/\3

Three expressions: day, month, and year. Recall them in a different order and a day/month/year date becomes month/day/year. Use this only when you know the pattern identifies dates; otherwise, it could also change other numbers separated by slashes.

Recall Works Inside the Find Field Too

This is the trick most people never discover. You can create an expression and refer back to it in the same search string.

Find: ([a-z])\1\1

Replace: \1\1-\1

That doesn’t find just any three letters. It finds the same letter three times running, as in crosssection, shelllike, or tarifffree, and inserts a hyphen where it belongs. One caution: if a URL contains www, the search will find those three w’s too, and you very much don’t want to hyphenate them. Narrowing the character set to ([a-vx-z]) sidesteps that particular problem.

The Caret: Finding Things You Can’t See

What do nonbreaking spaces, tab characters, and paragraph marks have in common? They’re invisible or awkward to enter directly in the Find field. For these, Word uses caret codes.

Character Symbol
Nonbreaking space ^s
Nonbreaking hyphen ^~
Tab ^t
Line break ^l
Paragraph mark ^13 (Find) / ^p (Replace)
En dash ^=
Em dash ^+

Two things to remember. The paragraph mark really does differ between the two fields: use ^13 in Find and ^p in Replace. Using the wrong one is a common cause of Word’s “not a valid character” error.

A nonbreaking space looks just like a normal space on screen, so get into the habit of writing [ ^s] whenever you mean “a space.” It catches both. Similarly, [\-^~] catches an ordinary hyphen and a nonbreaking hyphen. It’s a small bit of insurance that can save a lot of confusion.


Before You Press Replace All

Here are four rules, and they're not optional.

  1. Save the document. Then use Save As to make a copy and work in that. Undo is a great friend when you delete something by mistake, but it’s startling how quickly you can get beyond its help.

  2. Ask whether you’re being too broad. Is there anything unwanted that fits your pattern? Are you certain? It’s always best to take a beat before a Replace All nightmare.

  3. Think about the sneaky text. URLs, footnotes, and references break the normal rules of language, and they can surprise you.

  4. Check Track Changes. It records every replacement and can make a large batch harder to review, so decide whether to leave it on and inspect the changes afterward.

Before you commit, run Find Next a few times and look at the hits.


Get the Full Guide for Free

This blog only scratches the surface of what you can do with wildcards in Find and Replace.

Brave New Word is our free e-book on wildcard Find and Replace in Word and PerfectIt. It covers the complete symbol set, dozens of worked examples for medical, legal, technical, proposal, and academic writing, a troubleshooting chapter for when a string misbehaves, and two chapters on building wildcard checks into PerfectIt so you never have to type the same string twice. There’s also a printable cheat sheet at the back.

Previous
Previous

How to Use the Wildcard Find & Replace Check in PerfectIt

Next
Next

Word Wildcards: A Complete Guide for Editors