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:
Figure 1. The expanded Find and Replace dialog box.
Figure 2. The Find Font 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.
The First and Last Word on Word! Bestselling For Dummies author Dan Gookin puts his usual fun and friendly candor back to work to show you how to navigate Word 2013. Spend more time working and less time trying to figure it all out! Check out Word 2013 For Dummies today!
When using pattern matching in a search, you can specify individual characters or ranges of characters you want matched ...
Discover MoreThe pattern matching capabilities of Word's search engine are quite powerful. You can tailor your search pattern so that ...
Discover MoreThe Find and Replace feature in Word is very powerful. So powerful, in fact, that you can change the formatting on ...
Discover MoreFREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
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
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
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.
Visit the WordTips channel on YouTube
FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2022 Sharon Parq Associates, Inc.
Comments