Searching for Text that Doesn't End a Paragraph

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


Richard needs to search through a document and look for a period followed by a quote mark (."), but only if those two characters do not occur at the end of a paragraph. He figures this search can be done using wildcards, but he's not quite sure of the pattern to use in the search.

There are a couple of ways you can tackle this need. The first is to follow the brute-force method of using Find and Replace. Using multiple passes through the document, simply rename the item you don't want to change, change what's left, then rename the original back to whatever it was to start with. In the first of these three passes you would search for a period, quote mark, and paragraph mark, replacing it with something that doesn't occur in the document (such as the phrase 'parmark'). Then search for the period and quote mark combination and replace it with whatever you want. Finally, search for the phrase you used ('parmark') and replace it with a period, quote mark, and paragraph mark.

There is a huge drawback to this approach, though, and it is introduced because you are replacing paragraph marks. Remember that a paragraph mark contains the paragraph-related formatting for the paragraph that it ends. If you do away with a paragraph mark in the Find-and-Replace operation, then the paragraph becomes part of the following paragraph and loses any distinctiveness it had. Thus, if the ." combo ended a bulleted or numbered list paragraph, the Find and Replace "unformats" that paragraph and causes it to adopt the formatting of whatever paragraph follows it.

The solution is to, instead, use the second method, which involves doing a wildcard search. When you display the Replace tab of the Find and Replace dialog box, make sure the Use Wildcards check box is selected. (To see the check box, you'll need to click the More button if it is available.) In the Find What box, use this pattern:

.[""][!^13]

This pattern means you are searching for a period followed by a single character designated by whatever is in the first set of brackets. There are two characters there: a regular quote mark and a closing smart quote. (Wildcard searches make a distinction between normal quotes and smart quotes.) The closing smart quote is most easily entered by using copy and paste—copy it from someplace in your document and paste it into the pattern.

The second set of brackets in the pattern specify to find any character except the one noted. The character noted is a paragraph mark (^13) but adding the exclamation mark in front of it means don't match any paragraph marks.

There is an important caveat to mention here, and it has to do with the nature of the document you are searching. It is not uncommon to have "trailing spaces" at the end of paragraphs. Normally you wouldn't notice a stray space or two, as they don't really show up on the screen and they don't affect what may be printed. However, they will affect this particular wildcard search. The ." combo followed by a space or two and then a paragraph mark is much different than ." followed immediately by a paragraph mark. The wildcard search will match the former and ignore the latter, when you probably want it to match both.

The only way around this potential gottcha is to make sure that you get rid of any trailing spaces before your do the search for the ." combo. It is easiest to see if you have such trailing spaces in your document by turning on non-printing characters so they are visible. You can also do a regular Find and Replace, looking for a space followed by a paragraph mark and replacing it with a paragraph mark.

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

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

Printing Show/Hide Characters

Non-printing characters are very handy to view when editing a document. But what if you want those characters to no ...

Discover More

Tool to View Field Codes

Fields can be used to add all sorts of dynamic data to your documents. Viewing the field codes, at times, is desirable. ...

Discover More

Rounded Corners on Cells

As you are formatting a worksheet, Excel allows you to easily add borders to cells. Adding rounded corners to cells is a ...

Discover More

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!

More WordTips (ribbon)

Changing the Position of the Dollar Sign

When you receive documents created by others, it is not unusual that you'll want to edit what they've written. For ...

Discover More

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

Copying Found Items to a New Document

Word allows you to use its searching capabilities to easily find multiple items in a document. What if you want to copy ...

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 five more than 8?

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.