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 November 24, 2018)
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

Activating a Hyperlink

Excel worksheets allow you to include hyperlinks that lead to resources on the Internet. Here's how to activate those ...

Discover More

Using Alt to Switch Language Keyboards

There are scores of keyboard shortcuts built into both Windows and Word. If you run into a conflict between shortcut ...

Discover More

Saving Search and Replace Information in a Macro

You may want to save a user's existing Find and Replace settings before changing them in your macro. This tip examines ...

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 (menu)

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

Replacing a Colon in a Sequence

Sometimes you'll run across the need to replace a very specific sequence of characters in your document. It is for these ...

Discover More

Replacing Multiple Spaces with Tabs

If you get a document or some text that has multiple consecutive spaces used to align information, you'll undoubtedly be ...

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

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.