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.
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.
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!
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 MoreSometimes you'll run across the need to replace a very specific sequence of characters in your document. It is for these ...
Discover MorePattern matching is a type of searching you can do in Word that is very powerful. Despite its power, it remains rather ...
Discover MoreFREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)
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.
Visit the WordTips channel on YouTube
FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2024 Sharon Parq Associates, Inc.
Comments