Replacing Text and Capitalizing a Letter in One Step

by Allen Wyatt
(last updated September 26, 2015)

6

Joe has a document in which he wants to use Find and Replace. He needs to replace all instances of the word "paragraph" with a paragraph mark, which he knows how to do. However, he also wants to delete the space after the word "paragraph" (also easy) and then capitalize the letter after the space. He wonders if there is a way to do this using Find and Replace in a single pass.

You actually can perform this task using a single pass of your document with Find and Replace. The trick is in effectively using the wildcard search capabilities provided by Word. Follow these steps:

  1. Press Ctrl+H to display the Replace tab of the Find and Replace dialog box.
  2. Click the More button, if it is visible. (See Figure 1.)
  3. Figure 1. The expanded Find and Replace dialog box.

  4. Make sure the Use Wildcards check box is selected.
  5. In the Find What box, enter "[pP]aragraph^32([a-zA-Z])" (without the quote marks).
  6. In the Replace With box, enter "^p\1" (again, without the quote marks).
  7. With the insertion point still in the Replace With box, click the Format button and then choose Font. Word displays the Find Font dialog box. (See Figure 2.)
  8. Figure 2. The Find Font dialog box.

  9. Make sure that the All Caps check box has a check mark in it. (Click the check box however many times is necessary until you see a check mark.)
  10. Click OK to close the Find Font dialog box.
  11. Click on Replace All.
  12. Close the Find and Replace dialog box.

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (1858) applies to Microsoft Word 2007, 2010, and 2013.

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

Unwanted Graph Paper Effect

When you open a document or start to use Word, do you see a background that looks like graph paper? It could be because of ...

Discover More

Updating Automatically When Opening Under Macro Control

If your workbook contains links, you are normally given the opportunity to update those links when you open the workbook. ...

Discover More

Words Disappear from the Custom Dictionary

The spell-checking tool built into Word allows you to easily add words to a custom dictionary. What happens, though, if those ...

Discover More

Do More in Less Time! Are you ready to harness the full power of Word 2013 to create professional documents? In this comprehensive guide you'll learn the skills and techniques for efficiently building the documents you need for your professional and your personal life. Check out Word 2013 In Depth today!

More WordTips (ribbon)

Adding an Ellipsis to the Beginning of Some Paragraphs

The Find and Replace feature of Word is very powerful. You can even use it to add a unique character to the beginning of ...

Discover More

Specifying a Number of Matches

The wild card searching capabilities of Word are amazing. One thing you can do with wild cards is to specify not only a ...

Discover More

Ordering Search and Replace

The wildcard searching available in Word is very powerful. Here's how you can use ordering in your search efforts to make ...

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}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 8Mpixels. 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 7 - 0?

2015-09-29 08:54:49

Ken Endacott

Here are some references on using wildcards.
http://www.gmayor.com/replace_using_wildcards.htm
http://word.mvps.org/FAQs/General/UsingWildcards.htm
http://www.funduc.com/regexp.htm

Someone else's command strings often don't do exactly what you want. With an understanding of wildcards you can modify them to suit your exact needs. For example the word paragraph might be legitimately embedded in the text but when intended as a flag it is followed by several spaces. The following will detect if the word has two or more following spaces.

[pP]aragraph^32{2,}([a-zA-Z])
^p1

The command {2,} will search for two or more of the preceding character. Similarly, {2,4} will find only two, three or four spaces.


2015-09-28 10:58:24

Jennifer Thomas

@Ken Endacott - that is a very nice explanation of wildcards and using expressions - kudos!


2015-09-28 06:56:11

Ken Endacott

Mohan
You probably haven't ticked Use Wildcards.

Richard
The Find string is essentially a list of instructions telling what to search for.
[pP] is one character either p or P. With wildcards Find is case sensitive so you need to specify both.
Then follows characters to spell out the rest of the word paragraph or Paragraph.

^32 is the ASCII value of a space character. You can use an actual space but it can be difficult to see how many spaces there are or even if a space is present.

[a-zA-Z] is one character in the range a to z or A to Z.

The round brackets create a group which in this instance is a single alphabetic character.

The replace dialog consists of ^p which is a paragraph mark followed by 1 which gives the result of grouping 1 (if there are several groupings they are 1 2 etc.)
All Caps is applied to the replace so that the alphabetic character will be replaced by the same character in upper case.

In summary, Find will search for the word paragraph or Paragraph followed by one space followed by an alphabetic character. Replace replaces what is found by a paragraph mark and the alphabetic character in upper case, in the process deleting the word paragraph.


Harold
Your suggestion is a worthwhile refinement that would also delete a leading space. Otherwise the space will end up preceding the paragraph mark.


2015-09-28 03:36:26

Richard

You'll have to explain that a bit more. I recognise 32 as space (with a delimiter ^) and ([a-zA-Z]) as any letter, and ^p as the paragraph mark, but what about the rest?


2015-09-28 03:02:35

Mohan

I don't know why, but it is not working in my work. I use MS Word 2007


2015-09-27 09:21:01

Harold Druss

Include the space before the word paragraph in the find dialog.

^32[pP]aragraph^32([a-zA-Z])

Include a period in the replace dialog.

^46^p1


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.

Newest Tips
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.