MS Word

Find Any Character, Digit, or Letter

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

^p

A paragraph mark.

^t

A tab.

^?

Any single character (letter or number). For example, ^p^t^? finds any character preceded by a tab that appears after a paragraph mark.

^#

Any digit. For example, ^p^# finds a paragraph that starts with a number.

^$

Any single letter (not a digit).

^^

A caret (the single caret is used to identify other codes).

^%

A section character ().

^v

A paragraph character (-not a paragraph mark).

^n

A column break.

^+

An em dash ().

^=

An en dash ().

^e

An endnote mark.

^d

A field.

^f

A footnote mark.

^g

A graphic.

^l

A manual line break.

^m

A manual page break.

^~

A nonbreaking hyphen.

^-

An optional hyphen.

^s

A nonbreaking space.

^b

A section break.

^w

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.