Word pro tips: Use Wildcards for faster, more accurate search-and-replace results

Wildcards represent whatever you need to find or change in a document.

word primary 100025314 large
Rob Schultz

Today's Best Tech Deals

Picked by PCWorld's Editors

Top Deals On Great Products

Picked by Techconnect's Editors

Wildcards are used in computer programs, languages, search engines, and operating systems to simplify search criteria. It’s similar to how wildcards are used in Scrabble or Poker. For example, in Poker, when aces are wild, that means an ace can represent any card in the deck. The same is true for wildcards in programs such as Word, Excel, PowerPoint, Windows, and even Google. In a nutshell, wildcards search for everything * or specific things?; define ranges [ ]; create groups ( ); repeat @, { }; anchor < >; and make exceptions ! (also known as Boolean NOTs).

How to access wildcards

From the Home tab, go to Editing group, select Find > Advanced Find (or press Ctrl+H). The Find & Replace screen appears. Click the More button to open the window for additional options.

01 find replace more options JD Sartain
02 find replace use wildcards JD Sartain

Under Search Options, check the box beside Use Wildcards. Then click the Special button at the bottom of the window, and the Special (characters) window appears.

03 wildcards JD Sartain

And last, choose a wildcard from the list. But, what to choose, how does it work, and why use them in the first place?

Anyone who works with large documents (hundreds of pages) knows how long it takes to make global changes using just the basic Search and Replace options. For example, if you want to find all occurrences of someone named Ann, the basic Search and Replace only locates Ann, Anne, and Anniversary (if it’s capitalized) because wildcard searches ARE case sensitive.

However, it you enter lowercase ann, you’ll find Cezanne, planning, channel, cannonball, mannequins, and other words containing those letters, but not the woman's name. Then, if you replace all occurrences of lowercase ann with mae, you’ll get some very odd results: maeiversary, Cezmaee, plmaeing, chmaeel, cmaeonball, mmaeequins, etc. Situations like this illustrate best how wildcards can save the day!

How wildcards work

First, you have to determine what to search for and then what to replace it with. Between the Special Wildcard characters [ ] { } < > ( ) - @ ? ! * \ and the other special characters (tab, caret, em dash, etc.) you can find and replace almost anything, plus use these same tools to quickly (and completely) reformat your documents.

One of the most common wildcards is the asterisk (better known as the star), which means everything. So, *.* (star-dot-star) means 'search for everything before the period/dot and everything after the dot.' This would include every document, graphic, file, etc., that has a filename followed by a dot followed by an extension. For example, if you were searching for just graphics, you might type *.jpg (star dot jpeg), and the program would find every file that ends with .jpg.

But let’s say, hypothetically, you want to find all the characters in a story that begin with J and end with y, to see if you have too many character names that sound alike. In the Find What box type J*y (uppercase J, star, lowercase y), and Word finds Johnny, Judy, Jacky, Jerry, Jimmy, etc.

04 using the star wildcard JD Sartain

Using the star wildcard

Using the star wildcard, you can narrow your search to one of these characters at a time and replace some of the J names with other character names, such as Mike instead of Jacky, Andrew instead of Jerry, and Phil instead of Jimmy.

The second most popular wildcard is the question mark. The difference between the question mark and the star is this: Use the question mark to represent a single character, and use the star to represent as many characters as you want (including spaces and punctuation, or none at all). In this example, if you entered b?t in the Find What box, Word finds bit, bat, bot, button, bottom, better, b t (b space t), and b,t (b comma t).

05 using the question mark wildcard JD Sartain

Using the star wildcard; however, Word would also find bright, brutal, before the, and be together.

Using the @ wildcard

The @ (at sign) finds one or more occurrences of the previous character. For example, bo@t finds bot, boot, booty, bottom, bootlegger, bottle, etc.

06 using the at sign wildcard JD Sartain

Using the backslash symbol

The \ backslash symbol isn’t really a wildcard, although it's listed as such in the wildcard characters. It actually functions as an escape character, indicating a control or escape sequence, which means it’s used to signify that the character following it (which is a wildcard) should not be treated as a wildcard but, instead, as a normal keyboard character. So, the ? (question mark) is a wildcard used to find a single character, and it’s a punctuation mark used to designate a question.

For example, if you wanted to replace all the question marks in your document with exclamation points, you must use the \ backslash character before the ? question mark to tell Word that the question mark, in this case, is punctuation and not a wildcard.

07 use the back slash character the question mark to find actual question marks JD Sartain

You can also use the backslash with other wildcards, such as the \n characters, which search for a specific expression and then replace it with the rearranged version of that expression. For example, in your 2,000-page document, the client’s name is listed as both Allen Frederick and Frederick Allen. The second one is correct, so enter (Allen) (Frederick) in the Find What box and \2 \1 in the Replace With box. Word locates and changes all occurrences of Allen Frederick to Frederick Allen without altering any of the correct versions of the client’s name. Be sure to use the ( ) (parentheses) to separate expressions into groups.

Note: Parentheses (also called round brackets) are not actually wildcards and do not affect the search parameters, but they are the most useful feature of complex wildcard search-and-replace operations. They are used to separate the expressions into logical sequences. They must be used in pairs (same number of opening as closing). Also note that they are addressed by number in the replacement.

08 use the backslash with other wildcards to rearrange names or phrases JD Sartain

Using square brackets

The [ ] (square brackets), which are always used in pairs, identify explicit characters or a range of characters. The characters inside the brackets alone mean 'find this OR that,' as in [xyz], which finds every occurrence of x, or y, or z in every word throughout the document (but not x, y, and z together). The dash (or hyphen) means 'through,' as in [A-Z], which means A through Z, finds all uppercase letters in the alphabet, while [a-z] finds all lowercase letters, [0-9] finds all single digits, and [1-5] finds single numbers 1, 2, 3, 4, or 5. Ranges can include any character or series of characters, including spaces and punctuation.

Note: Ranges must be in ascending order. For example, [J-Z]ack finds Jack, Mack, and Zack (ascending order), but not lack, pack, rack, or tack because, although in the range, these words are lowercase. On the flip-side of that argument, [j-z]ack finds lack, pack, rack, and tack (also in ascending order), but not Jack, Mack, or Zack.

09 using wildcards square brackets and the hyphen character JD Sartain

Using the exclamation-point wildcard

The ! (exclamation point) inside the [ ] (square brackets) means 'except' or 'not' (like the Boolean operator NOT). That is when the characters inside the square brackets are preceded by the exclamation point, those characters are not included in the search. So, [!K-T]erry finds Berry, Gerry, and Jerry but not Kerry, Merry, Perry, and Terry. The exclamation point tells Word to find all occurrences of names that end in erry, but not (or except) those that begin with letters K thru T.

10 using the exclamation point wildcard like the boolean not operator JD Sartain

Using braces or curly brackets 

These braces { } (or curly brackets) count the occurrences of the previous character. For example, o{2} finds words that contain double o’s, as in wood, smooth, book, or zoom, and o{2,} finds words with double or triple o’s (but only in succession). Nonconsecutive triple o’s, as in notebook and notorious, don’t count, because the o’s are not consecutive.

11 using the braces aka curley brackets wildcards JD Sartain

Using the < and > wildcards

The < > (less-than and greater-than symbols) are best when combined with one or more of the other wildcards, and can be used in pairs or individually. These symbols mark the start and end of each word, respectively, and ensure that your searches return a single word. For example, <(pre)*(ed)> finds presorted and prevented. Other examples include: <”K” finds all entries beginning with a letter previous to the letter K in the alphabet, and >”F” and <”H” finds all words beginning with the letters F and G.

Try some wildcards and let us know what you think in the comments. 

12 using the less than and greater than wildcards JD Sartain


Note: When you purchase something after clicking links in our articles, we may earn a small commission. Read our affiliate link policy for more details.
Shop Tech Products at Amazon