Please Note: This article is written for users of the following Microsoft Word versions: 2007, 2010, 2013, 2016, 2019, Word in Microsoft 365, and 2021. 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: Searching for Characters.
Written by Allen Wyatt (last updated July 16, 2022)
This tip applies to Word 2007, 2010, 2013, 2016, 2019, Word in Microsoft 365, and 2021
In order to perform character searches, you must first enable pattern matching by allowing wildcards in your searches. To do this, you need to pull up either the Find or Replace tabs of the Find and Replace dialog box and click on the More button. In Word 2013 or a later version, type Ctrl+F to bring up the search pane on the left side of the window. Click on the magnifying glass and select Advanced Find which will display the Find and Replace dialog box; click More. 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.
With pattern matching in Word enabled, 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, [!abcdef] is valid, whereas [abc!def] is not. This really does make sense, since [!abcdef] 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 (270) applies to Microsoft Word 2007, 2010, 2013, 2016, 2019, Word in Microsoft 365, and 2021. You can find a version of this tip for the older menu interface of Word here: Searching for Characters.
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!
The Find and Replace capabilities of Word are very powerful. You can even use them to do some complex and specific ...
Discover MoreThe Find and Replace feature of Word is very powerful. You can even use it to add a unique character to the beginning of ...
Discover MoreThe pattern matching capabilities of Word's search engine are quite powerful. You can tailor your search pattern so that ...
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 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.
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