Searching
Word's Find and Replace feature is a powerful and diverse tool that can search a document for a specific string of characters, for text with specific formatting, for text that includes special characters and nonprinting characters, for text specified by wildcards, and more. When the text sought is found, it can be replaced by different text with the same formatting or different formatting or by the same text with different formatting, it can be deleted, or it can be left unchanged. This page is an attempt to tell you everything that you may ever need to know about these different types of searches or to provide links to the information that you may need. The first sources of information that should be mentioned are the relevant Microsoft Office help topics. For the Word 2010 help topic, see Search or Move Around in a Document Using the Navigation Pane. For the Word 2007 help topic, see Find and Replace Text or Other Items.
In the simplest type of search for specific text, you can open the Navigation pane (Word 2010) or the Find and Replace dialog box by pressing Ctrl+F or through the graphical user interface, type or paste the text to be found in the Search Document (Word 2010) or Find what (Word 2007) text box, and press Enter. The rest of this page describes how to utilize additional capabilities of the Find and Replace feature in your searches in the following sections.
- Finding and Highlighting All Instances
- Including Special Characters and Nonprinting Characters
- Searching for Formatted Text
- Using Wildcards
- Search Stopped Finding
Finding and Highlighting All Instances
Word enables you to find and highlight (select) all instances of the object of your search. When all the instances are highlighted (selected), you can change their formatting, copy them to the clipboard, or delete them all at once.
To find and highlight all instances
- Open the Find and Replace dialog box.
- To do this in Word 2010, on the Home tab, in the Editing group, click the arrow next to Find, and then click Advanced Find.
- To do this in Word 2007, press Ctrl+F.
- In the Find and Replace dialog box, in the Find what text box, type the text that you want to find and set any additional options for your search, as described in the other sections of this page.
- Set the options for highlighting all instances.
- To do this in Word 2010 or Word 2007, on the Find tab, click Reading Highlight, select Highlight All, click Find in, and select the appropriate option, such as Main Document.
- Click anywhere in your document and do one of the following:
- Press the applicable shortcut keys or click options on the Ribbon to change the formatting of the highlighted text.
- Copy all of the selected text to the clipboard.
- Press Delete to delete all of the highlighted text.
- Disable highlighting of all instances.
- To do this in Word 2010 or Word 2007, click Reading Highlight and select Clear Highlighting.
- Close the Find and Replace dialog box and then click anywhere in the document if you need to remove the highlighting from the selected text.
Including Special Characters and Nonprinting Characters
Codes for special characters and nonprinting characters can be added to the text that you insert in the Find what and Replace with text boxes. These codes can be inserted manually by typing the applicable code directly in the text box, or they can be inserted by clicking More, clicking Special, and clicking the name of the applicable character. The following table lists the special and nonprinting characters that you can insert into the Find what text box after clicking the Special button along with the corresponding codes and graphical representations of the nonprinting characters.
Special Character | Code | Nonprinting Symbol |
---|---|---|
End of paragraph | ^p or ^13 | ¶ |
Tab | ^t or ^9 | → |
Any character | ^? | |
Any digit | ^# | |
Any letter | ^$ | |
Caret (^) | ^^ | |
Section mark (§) | ^% | |
Paragraph mark or pilcrow (¶) | ^v | |
Column break | ^n or ^14 | ⋅⋅⋅Column Break⋅⋅⋅ |
Em dash (—) | ^+ | |
En dash (–) | ^= | |
Endnote mark | ^e | |
Field (with field codes displayed) | ^d | |
Footnote mark | ^f or ^2 | |
Graphic | ^g | |
Line break | ^l or ^11 | ↵ |
Page break | ^m | —Page Break— |
Nonbreaking hyphen | ^~ | – |
Nonbreaking space (hard space) | ^s | ° |
Optional hyphen | ^- | ¬ |
Section break | ^b | =Section Break= |
White space | ^w | |
Right to left mark | ^r | |
Left to right mark | ^h | |
No-width optional break (zero width non-joiner) | ^o | |
No-width non-break (zero width joiner) | ^y |
In addition, you can insert characters in the Find what text box by typing a caret (^) followed by the corresponding ASCII code (^nnn), including the opening (^19) and closing (^21) curly brackets of fields when field codes are displayed, and by typing ^u followed by the corresponding Unicode number (^unnnn). For example, you can search for the infinity sign (∞) by typing ^u8734.
Although the codes for any character (^?), any digit (^#), and any letter (^?) act like wildcards in a certain sense, Word does not treat them as wildcards. This means that they are used when the Use wildcards check box is not selected.
Not all the special and nonprinting characters in the preceding table can be inserted into the Replace with text box. Conversely, in the Replace with text box, you can insert a code for the clipboard contents and a code for the search string that appears in the Find what text box. The latter code is used when you want to add text or specific formatting to the original search string. The following table lists the special and nonprinting characters that you can insert into the Replace with text box after clicking the Special button along with the corresponding codes and graphical representations of the nonprinting characters.
Special Character | Code | Nonprinting Symbol |
---|---|---|
End of paragraph | ^p | ¶ |
Tab | ^t or ^9 | → |
Caret (^) | ^^ | |
Section mark (§) | ^% | |
Paragraph mark or pilcrow (¶) | ^v | |
Clipboard contents | ^c | |
Column break | ^n or ^14 | ⋅⋅⋅Column Break⋅⋅⋅ |
Em dash (—) | ^+ | |
En dash (–) | ^= | |
Find what contents | ^& | |
Line break | ^l or ^11 | ↵ |
Page break | ^m | —Page Break— |
Nonbreaking hyphen | ^~ | – |
Nonbreaking space (hard space) | ^s | ° |
Optional hyphen | ^- | ¬ |
Right to left mark | ^r | |
Left to right mark | ^h | |
No-width optional break (zero width non-joiner) | ^o | |
No-width non-break (zero width joiner) | ^y |
You can also insert characters in the Replace with text box by typing a caret (^) followed by the corresponding ASCII code (^nnn), but you cannot use Unicode numbers in this text box.
Searching for Formatted Text
You can use the Find and Replace feature to search for specific text or any text with specific formatting. When text with specific formatting is found, you can replace the text found, change the formatting of the text found, copy the text found to the clipboard, or delete the text found. For example, you can use the following general procedure to find all the underlined text in a document and copy it to another location, to change all the underlined text in a document to bold text, to apply specific formatting to a specific word or phrase, and more.
To search for text with specific formatting
- Open the Find and Replace dialog box at the Find tab if you only want to find text with specific formatting for the purpose of copying it to the clipboard, changing its format, or deleting it, or press Ctrl+H in any version of Word if you want to replace the text found or set additional formatting.
- To open the Find and Replace dialog box at the Find tab in Word 2010, on the Home tab, in the Editing group, click the arrow next to Find, and then click Advanced Find.
- To open the Find and Replace dialog box at the Find tab in Word 2007, press Ctrl+F.
- In the Find and Replace dialog box, in the Find what text box, type the specific text that you want to find with specific formatting. If you want to find any text with specific formatting, leave the Find what text box empty.
- Click More.
- In the expanded Find and Replace dialog box, click the Formatting button, select a type of formatting, such as Font, and configure the formatting options that you want to find. You can then select additional types of formatting and set the formatting options that you want to find for each of them. Alternatively, you can press keyboard shortcuts to set formatting options. Notice the description of the selected formatting options that appears below the Find what text box.
- If you want to find and highlight all instances of the object of your search, on the Find tab, request highlighting as described in To find and highlight all instances. When all the instances of the text found are highlighted, you can click options on the Formatting toolbar to change the formatting of the highlighted text, copy all of the selected text to the clipboard, or press Delete to delete all of the highlighted text. After you disable the highlighting, skip to the last step of this procedure.
- If you want to replace the text found or set additional formatting, on the Replace tab, click inside the Replace with text box.
- If you want to change the text, type the text that should replace the text found. If you only want to set additional formatting, type ^&.
- If you want to set additional formatting, click the Formatting button, select a type of formatting, such as Font, and set the formatting options that you want to apply. You can then select additional types of formatting and set the formatting options that you want to apply. Alternatively, you can press keyboard shortcuts to set formatting options. Notice the description of the selected formatting options that appears below the Replace with text box.
- Follow the steps in To clear all the search formatting options to clear all the formatting options that you set.
Consider the scenario in which you want to change all the underlined text in a document to bold text. In this case, press Ctrl+F to open the Find and Replace dialog box with the Find tab selected. In the Find what text box, press Ctrl+U without typing any text, set the options for highlighting all instances of unlining as described in To find and highlight all instances. When all the underlined text is selected, click the Bold button on the Formatting toolbar to apply bold formatting, click the Underline button to remove the underlining, and then click anywhere in the document to remove the highlighting. After you disable highlighting, follow the steps in Search Stopped Finding to clear the formatting options that you set for your search.
Using Wildcards
The Find and Replace feature supports a rich set of wildcards and related symbols. For example, you can use wildcards to find a group of similarly spelled words, all the acronyms in a document, dates typed in a certain format, and more. To use wildcards in your search, click More and then select the Use wildcards check box after you open the Find and Replace dialog box according to the instructions in the previous procedure for your version of Word. The following table lists the wildcards and related symbols that you can use in the Find what text box when the Use wildcards check box is selected along with their meanings and examples of how they can be used.
Wildcard or Symbol | Meaning | Example | Results |
---|---|---|---|
? | Represents any single character. | f?x | Finds fax, fix, and fox. |
* | Represents one or more characters. | b*n | Finds ban and brown. |
< | Marks the beginning of a word. | <over | Finds over and overstated, but not rover. |
> | Marks the end of a word. | og> | Finds dog and fog, but not foggy. |
() | Defines an ordered part of the search string. | (John) (Doe) | Finds John as the first part and Doe as the second part. |
[] | Defines a set of possible characters. | p[aeiou]t | Finds pat, pet, pit, pot, and put. |
- | Indicates a range within a set of possible characters. | [A-Z] | Finds any uppercase letter. |
! | Indicates that any character except those in the set will be found. | p[!aeio]t | Finds put, but does not find pat, pet, pit, or pot. |
{n} | Indicates n occurrences of the preceding character or characters in the preceding set of characters. | b[aio]{2}t | Finds bait, boat, and boot, but does not find bat or bit. |
{n,} | Indicates at least n occurrences of the preceding character or characters in the preceding set of characters. | b[aio]{1,}t | Finds bait, boat, boot, bat, and bit. |
{n,m} | Indicates from n to m occurrences of the preceding character or characters in the preceding set of characters. | b[aeiou]{2,3}t | Finds bait, beaut, boat, and boot, but does not find bat or bit. |
@ | Indicates at least one occurrence of the preceding character or characters in the preceding set of characters. | b[aeiou]@t | Finds bait, beaut, boat, boot, bat, and bit. |
\ | Indicates that the next character should not be treated as a wildcard character or related symbol. | \(f?x\) | Finds (fax), (fox), and (fix), but does not find fax, fox, or fix. |
When the Use wildcards check box is selected, all the letters included in your search string are case-sensitive, and the Match case check box is grayed out. In addition, some of the codes that could be used in the Find what text box when Use wildcards is not selected are not available when Use wildcards is selected. On the other hand, all the codes that could be used in the Replace with text box when Use wildcards is not selected are available when Use wildcards is selected. The following table lists the codes for special and nonprinting characters that you can also insert into the Find what text box when Use wildcards is selected.
Special Character | Code | Nonprinting Symbol |
---|---|---|
End of paragraph | ^13 | ¶ |
Tab | ^t or ^9 | → |
Caret (^) | ^^ | |
Section mark (§) | ^% | |
Paragraph mark or pilcrow (¶) | ^v | |
Column break | ^n or ^14 | ⋅⋅⋅Column Break⋅⋅⋅ |
Em dash (—) | ^+ | |
En dash (–) | ^= | |
Footnote mark | ^2 | |
Graphic | ^g | |
Line break | ^l or ^11 | ↵ |
Page break | ^m | —Page Break— |
Nonbreaking hyphen | ^~ | – |
Nonbreaking space (hard space) | ^s | ° |
Optional hyphen | ^- | ¬ |
When you use parentheses to define ordered parts of a search string, you can replace each string found with a rearranged expression by using \n codes. For example, if your search string is (John) (Doe), type \2, \1 in the Replace with text box to replace it with Doe, John.
When you are finished using wildcards, clear the Use wildcards check box and perform another search to disable wildcards.
For more examples and useful information about using wildcards, see Finding and Replacing Characters Using Wildcards.
Search Stopped Finding
Sometimes you may search for a word or phrase that is found in your document, and Word will not find it. The usual reason for this is that some formatting options were selected in a previous search, and Word will remember them until they are cleared in another search. For example, if you search for a word with bold font formatting and then search for a different word or phrase that does not have bold formatting, Word will find the new search only if you clear the bold formatting from the search options. Remembering to clear every formatting option that you select would be a difficult task, since there are many options on each of the dialog boxes that can be opened from the drop-down list that appears when you click the Format button.
Fortunately, the Find and Replace dialog box indicates the formatting options that have been selected for the search string and for the replacement string directly below the Find what and Replace with text boxes and provides a simple way to clear all the formatting. If you find that searches fail to find text that you know is in your document, perform the following steps to clear all the search formatting options.
To clear all the search formatting options
- Press Ctrl+H.
- In the Find and Replace dialog box, if there are any indications below the Find what or Replace with text box that formatting options are selected for the search string or the replacement string, click More.
- In the expanded Find and Replace dialog box, click the No Formatting button and clear all the check boxes.
- Click Less.
- Perform a new search before closing the Find and Replace dialog box.