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

Unwanted Hyperlinks

Tired of having Excel convert what you type into active hyperlinks? Here are things you can do to undo Excel's ...

Discover More

Inserting the User's Initials

One of the pieces of information tracked by Word are your name and initials. You can insert your initials by using the ...

Discover More

Formatting Text in Custom Document Properties

Word allows you to create custom document properties that stay with a document and can be inserted through the use of ...

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)

Replacing Highlighted Words

The Find and Replace capabilities of Word are quite powerful. Knowing how to find and replace highlighted text can be a ...

Discover More

When Replace Doesn't Work

Find and Replace is a great tool, but what are you to do if your find or replace doesn't work as you expect? This tip ...

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 8 - 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.