Please Note: This article is written for users of the following Microsoft Word versions: 2007, 2010, and 2013. If you are using an earlier version (Word 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Word, click here: Understanding Pattern Matching.

Understanding Pattern Matching

by Allen Wyatt
(last updated August 29, 2015)


The Find and Replace feature built into Word includes two completely different search engines. In the normal search engine you search for simple items, such as text or special characters. Tips related to this type of searching have been presented in other issues of WordTips.

The second search engine is the more powerful, however. It uses a search method known as pattern matching. When you use pattern matching you can search for very complex and very subtle character sequences in your document. Unfortunately, learning the pattern matching capabilities of Word can sometimes be frustrating.

How you switch between the two different search engines depends on the version of Word you are using. In most versions of Word you should pull up either the Find or Replace tabs of the Find and Replace dialog box and click on the More button. In the expanded area of the dialog box, make sure the Use Wildcards checkbox is selected. This causes Word to interpret what is in the Find What and Replace With boxes entirely differently than if the checkbox is not selected.

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (263) applies to Microsoft Word 2007, 2010, and 2013. You can find a version of this tip for the older menu interface of Word here: Understanding Pattern Matching.

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


Using BIN2DEC In a Macro

Need a way, in a macro, to convert binary numbers into their decimal equivalents? There are two ways you can get the ...

Discover More

Worksheet Events

You can create macros that are automatically executed whenever certain events occur within a worksheet. This tip details ...

Discover More

Clearing Only Filtering Settings

When you filter data in a worksheet, Excel also allows you to apply sorting orders to that data. Here 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)

Searching for Characters

When using pattern matching in a search, you can specify individual characters or ranges of characters you want matched ...

Discover More

Matching At the Beginning or End of a Word

The pattern matching capabilities of Word's search engine are quite powerful. You can tailor your search pattern so that ...

Discover More

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

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

View most recent newsletter.


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 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 minus 0?

2019-09-21 03:02:48

Ken Endacott

Rich, the macro pauses and gives a message each time a zero result field is found. It might be quicker if the macro highlighted all the zero result fields in one pass then you can go over them individually. To do this, replace the line:

MsgBox "The field " & aField.Code & " returns zero"


aRange.HighlightColorIndex = wdPink

2019-09-20 10:40:24


Ken, thanks a LOT! I'll give this a try. It's sure to save me plenty of anguish.

2019-09-14 04:34:02

Ken Endacott


Here is a macro that will do what you want.

Sub findFields()
Dim aField As Field
Dim aRange As Range
Dim k As Long
Application.Browser.Target = wdBrowseField
Set aRange = Selection.Range
k = aRange.Fields.Count
If k > 0 Then
Set aField = aRange.Fields(1)
If Trim(aField.Result.Text) = "0" Then _
MsgBox "The field " & aField.Code & " returns zero"
MsgBox "No more fields found "
End If
Selection.Collapse Direction:=wdCollapseEnd
Loop Until k = 0
End Sub

2019-09-13 11:30:38


I have had this problem for years and I can't seem to find a satisfactory answer for it:
I use LOTS of field codes in my documents. These documents then get forwarded to lots of people for review - people who have no idea what a field code is and have no interest in learning what it is. Naturally, when the document returns back to me there are likely going to be a lot of broken field codes, "ERROR! Reference source not found" Those are easy to deal with. I just search for "Error!" and fix them.
HOWEVER... sometimes my x-refs don't error, but they will display "0" instead. Searching for "0" is inefficient in a document full of numbers. I want to search for "0" in a FIELD, but there doesn't seem to be anyway to do that. Evidently, I can search for a field, but I need to know the name of the field and I don't think I can search for a NAMED FIELD OF A PARTICULAR VALUE ('0')

Any insight on why this happens ("0" vs "Error!") and how to fix it without slogging through page by page? Thanks.

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

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.