Please Note: This article is written for users of the following Microsoft Word versions: 97, 2000, 2002, and 2003. If you are using a later version (Word 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Word, click here: Searching for Characters.

Searching for Characters

Written by Allen Wyatt (last updated October 19, 2024)
This tip applies to Word 97, 2000, 2002, and 2003


If you have enabled pattern matching in Word, you can easily specify the exact characters you want to search for. This is done by enclosing the characters in square brackets. For instance, if you want to search for an uppercase A, you would specify this as [A]. If you wanted to search for other characters in addition to the A, you would place them in the brackets as well. For instance, [AEIOUaeiou] searches for all vowels, in either upper- or lowercase.

You can also specify a range of characters you want to search for within the brackets. For example, if you want to search for any digit, you could search for [0-9]. This will match any single digit between 0 and 9. Ranges, of course, can be combined with other characters to find specific characters. Thus, you could specify [A-E0-4] and Word would find only the characters A, B, C, D, E, 0, 1, 2, 3, and 4.

You should note that a pair of square brackets is used to denote a single character to be matched. If you want to find a sequence of characters, then you need to use multiple brackets. For instance, let's say you have a document that has some part numbers in it. These are designated by your company as the characters PN- followed by a single uppercase letter between A and D, followed by a single digit, followed by any uppercase letter of the alphabet. To search for these, without returning other easily confused sequences, you would use PN-[A-D][0-9][A-Z] as your search string. This returns sequences of three characters and only three.

Another helpful modifier to use within the brackets is the exclamation point. This is the same as saying "not" or "anything except." For instance, if you wanted to match any character except lowercase vowels, you would use [!aeiou]. This character must be used at the beginning of the characters within the brackets. Thus, [!abc] is valid, whereas [abc!def] is not. This really does make sense, since [!abc] is logically correct whereas [abc!def] is logically inconsistent.

Pattern matching in Word also understands that a question mark is a placeholder for a single character and an asterisk is a placeholder for any number of characters. In other words, if you searched for n?t, Word would find nut, not, and net. If you instead searched for n*t, those three words would be matched as well as neat, next, and the portion of "pattern matching" between the n (in pattern) and the t (in matching).

If you wanted to actually search for a hyphen, an exclamation point, a question mark, an asterisk, a bracket, a brace, the greater-than character, the less-than character, the at sign, or parentheses (all of which have special meaning), simply precede the character with a back slash (\). For instance, if you wanted to search for characters used to end sentences (period, question mark, and exclamation mark), you would enter your specification as [.\?\!].

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (1184) applies to Microsoft Word 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Word (Word 2007 and later) here: Searching for Characters.

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

Initiating a New Search

I do a lot of searching in my documents. Sometimes the searches may not go exactly as I expected. Here are some things I ...

Discover More

Deleting All Comments

Have comments in your document? Want to get rid of them all? The easiest way to do so is going to depend on the ...

Discover More

Inserting a Break with a Macro

Inserting a break in your document is easy. You may think that inserting one using a macro is more complex, but it isn't. ...

Discover More

Learning Made Easy! Quickly teach yourself how to format, publish, and share your content using Word 2013. With Step by Step, you set the pace, building and practicing the skills you need, just when you need them! Check out Microsoft Word 2013 Step by Step today!

More WordTips (menu)

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

Replacing Spaces in Part Numbers with Dashes

Word has a power capability to search for information and then replace that information in some way. Finding the right ...

Discover More

Formatting Partial Results of a Search

The Find and Replace capabilities of Word are, simply, quite astounding. This is particularly true when using wildcard ...

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 two more than 7?

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 menu interface (Word 97, Word 2000, Word 2002, or Word 2003)? This site is for you! If you use a later version of Word, visit our WordTips site focusing on the ribbon 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.