Applying Styles and Removing Characters using Find and Replace

Written by Allen Wyatt (last updated January 20, 2024)
This tip applies to Word 2007, 2010, 2013, 2016, 2019, Word in Microsoft 365, and 2021


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:

\([a-d)]\)[ ]{1,}(*^13)

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:

\([a-d)]\)

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:

[ ]{1,}

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:

(*^13)

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:

\1

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, 2016, 2019, Word in Microsoft 365, and 2021.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Getting Rid of Section Breaks, but Not Section Formatting

Word allows you to change the character of how your pages are designed by using multiple sections in a document. If you ...

Discover More

Hiding Graphics

Do you need a printout where graphics can be turned on and off? This tip provides some concrete ways you can get just ...

Discover More

Printing a Screen without the Print Screen Key

The Print Screen key is a handy way to grab a screen shot. What if your keyboard doesn't physically have such a key, ...

Discover More

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!

More WordTips (ribbon)

Changing Decimal Commas to Decimal Points

If you have a document that was produced in a country where decimal commas are used instead of decimal points, you may be ...

Discover More

Removing HTTP from URLs

Having problems when it comes to replacing information in URLs? You're not the only one; it can be confusing making mass ...

Discover More

Removing HTML Tags from Text

HTML tags are great when you want to display information on a web page. They are not so great when you have them in a ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is four less than 7?

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)


This Site

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.

Videos
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.