The Problem:
Find and Replace isn't flexible enough! I need to check references to a bunch of different product codes, CP408 through CQ917. As you can imagine, searching for "C" with "Match case" on finds me every capital C in the document. I want a better way!
The Solution:
There are two ways you can do this. The easiest way is to search for c^$^#^#^#
, which finds a C followed by any single letter and then three digits. To find special items, use the codes explained in Table 3-1. You can enter them by clicking the Special button in the Find and Replace dialog box (see Figure 3-12) when the "Use wildcards" box is unchecked, but once you find how useful they are, you'll find it quicker to type them.
Table 3-1. Special codes for Find and Replace
Code |
Meaning |
---|---|
|
A paragraph mark. |
|
A tab. |
|
Any single character (letter or number). For example, |
|
Any digit. For example, |
|
Any single letter (not a digit). |
|
A caret (the single caret is used to identify other codes). |
|
A section character (). |
|
A paragraph character (-not a paragraph mark). |
|
A column break. |
|
An em dash (). |
|
An en dash (). |
|
An endnote mark. |
|
A field. |
|
A footnote mark. |
|
A graphic. |
|
A manual line break. |
|
A manual page break. |
|
A nonbreaking hyphen. |
|
An optional hyphen. |
|
A nonbreaking space. |
|
A section break. |
|
Whitespace (one or more spaces, one or more tabs, or a combination of the two). |
Figure 3-12. The Special pop-up menu in the Find and Replace dialog box provides an easy way to enter the codes for special items.
The other way is to use regular expressions
, or combinations of text and wildcards. Check the "Use wildcards" box and enter C[P-Q]
(in capitals, as it's case-sensitive) in the "Find what" box, then click the Find Next button.