by Allen Wyatt
(last updated September 2, 2017)
In reformatting a document, Leah needs to apply the same paragraph style to all paragraphs beginning with (a), (b), (c), and (d). She can use Find and Replace to apply the style, but then she needs to do a second Find and Replace pass to get rid of the (a), (b), (c), and (d) characters. Leah wonders if there is a way to both apply the style and remove those characters in a single pass.
Actually, this can be accomplished with the use of wildcard characters in Find and Replace. Rather than go through all the steps, just remember that you want to do an advanced search (so that the Find and Replace dialog box is displayed), click the More button (if it is available) and then make sure the Use Wildcard check box is selected. Here is what you want to place in the Find What box:
This may look, at first glance, like gibberish—particularly if you are not used to using wildcards—but it is fairly straightforward. The backslashes at the beginning tell Word that the immediately following character should be used as a literal character. That means that the following sequence will search for (a), (b), (c), or (d), any of which would be considered a match:
If you might have other letters in parentheses, you could change the a-d part to something like a-z, so that any lowercase alphabetic character between parentheses would be matched.
The second part indicates that the next characters should be any number of spaces:
This assumes, of course, that the (a), (b), (c), or (d) is followed by at least one (or more) spaces. If some other character might immediately follow the parenthetical—such as a tab or no spaces at all—then this portion of the search pattern will need to be changed to reflect what is in your document.
The final part of the search pattern is this:
This tells Word to find any number of characters (*) up through and including a hard return. In other words, the entire paragraph is selected. The parentheses around this portion of the pattern are important, as they allow whatever matches this portion of the found text to be referenced in the Replace With field of the Find and Replace dialog box. In fact, this is all that should go into the Replace With field:
This tells Word that you want to replace whatever is found with what is in the first set of parentheses in the Find What pattern, which happens to be the entire paragraph minus the (a), (b), (c), or (d) and any trailing spaces. The only other thing you need to do is make sure that for the Replace With field you pick the style you need applied to replacement. (See Figure 1.)
Figure 1. Setting up the Find and Replace dialog box.
Once the Find and Replace dialog box is set up with the proper patterns (as described above), just click on Replace All and you are done.
WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (4274) applies to Microsoft Word 2007, 2010, 2013, and 2016.
Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!
Got a table that contains rows you want to delete? Deleting one or two rows in a table is easy; deleting a bunch of rows ...Discover More
Sarra is having a problem getting Find and Replace to behave properly when replacing italic-formatted text. This tip ...Discover More
Need to know how many paragraphs are in a document? You can use Word's Find and Replace feature to get a count quickly.Discover More
FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
Got a version of Word that uses the ribbon interface (Word 2007 or later)? This site is for you! If you use an earlier version of Word, visit our WordTips site focusing on the menu interface.