< Appendix A | Appendix C >

519 Appendix B. Find/Replace Expressions

This appendix lists all the available PowerFind and PowerFind Pro metacharacters, as well as the search options available when using Find/Replace expressions in a macro. For instructions on using Find/Replace, see Chapter 11; for macro syntax and conventions, refer to Chapter 12.

Wild Card Metacharacters

Wild Card metacharacters allow you to use a single expression to represent an entire set of characters; any character in the set will constitute a “match” to the metacharacter. Table B.1 lists the PowerFind (where applicable) and PowerFind Pro representations of each metacharacter. The “Same As” column gives an equivalent PowerFind Pro expression for some metacharacters. The right-hand columns indicate whether the metacharacter matches “European” (or diacritical) characters (Eu), the underscore character, ASCII 95 (und), and the return character, ASCII 13 (), plus how many of the 256 characters in a font are matched (# matches).

520 Description

PowerFind

PowerFind Pro

Same As

Eu

und

# matches

Any Character

.

Y

Y

N

255

Any Character or ¶

:. or :?

Y

Y

Y

256

Any Word

(Option-X)

:(\<:w:+\>:b*:)

Y

Y

N

Any Text

:.+

Y

Y

Y

A-Z a-z

:a

[A-Za-z]|:

Y

N

N

114

_, A-Z a-z

:A

[A-Za-z_]|:

Y

Y

N

115

_, non-(A-Z a-z)

(Option-A)

N

Y

Y

142

non-(A-Z a-z)

(Option-Shift-A)

N

N

Y

141

A-Z a-z 0-9

:n

[A-Za-z0-9]|:

Y

N

N

124

_, A-Z a-z 0-9

:N

[A-Za-z0-9_]|:

Y

Y

N

125

_, non-(A-Z a-z 0-9)

:~

N

Y

Y

132

0-9

:d or :#

[0-9]

N

N

N

10

a-z

:l

Y

N

N

59

A-Z

:u

Y

N

N

55

European1

: (Option-D)

Y

N

N

62

non-European1

(Option-Shift-D)

N

N

Y

194

Any Octal Digit

:o

[0-7]

N

N

N

8

Any Hex Character

:x or :h

[A-Fa-f0-9]

N

N

N

22

Any Character in a word2

:w

Y

Y

N

521 Any Gremlin3

:!

N

N

N

159

Any Gremlin, tab, or space

:@

:!|:b

N

N

N

161

Any Control Character4

: space5

N

N

N

31

Anything in set6

[ ]

N

Anything not in set6

[^ ]

N

Anything in set plus return6

:[ ]

Y

Anything not in set plus return6

:[^ ]

Y

Notes:
1
“European” or “Diacritical” characters are modified or accented alphabetic characters like å, Ç, é, and Æ. Their ASCII values are 128–159, 167, 174–175,190–191, 203–207, and 216.

2This metacharacter will match any character that is currently part of a “word” as Nisus Writer defines it (see Chapter 11, “What’s In a Word?”).

3A “gremlin” is defined as any character with an ASCII value of 0–8, 10–12, 14–31, or 127–255. These include “control” characters and “upper-ASCII” characters, and are most frequently seen in files imported from another system.

4A “control” character is defined as any character with an ASCII value of 0–12 or 14–31. Control characters are not printable in most Macintosh fonts.

5The metacharacter for “any control character” is a colon followed by a space (: ), not the word “space.”

6List the characters you want to find within the brackets. Everything between the brackets is interpreted literally, so you cannot use other wild cards within a set.

Table B.1. Wild Card metacharacters.

522 “Special” Metacharacters

“Special” characters (Table B.2) include those listed on the Find/Replace dialog box’s Special menu and a few other PowerFind Pro-specific metacharacters in the same vein. Each of these (except “OR”) matches just one or two specific ASCII values as shown in the “ASCII” column.

Description

ASCII

PowerFind

PowerFind Pro

OR

|

13

\r

Space

32

\s

Tab

9

\t

Space or Tab

9 or 32

:b

Page Break

12

\f

Null

0

\0

Backspace

8

\b

Linefeed

11

\v

Table B.2. “Special” metacharacters.

Repeat # Metacharacters

Repeat # metacharacters allow you to specify in your search pattern how many times a particular character, set, or wild card may occur consecutively and still match the pattern. Table B.3 lists the metacharacters found on the Repeat # menu plus the PowerFind Pro metacharacters for the “shortest match” of each expression (see Chapter 11).

523

Description

PowerFind

PowerFind Pro

0+

*

1+

+

0 or 1

-

0+, shortest match

:*

1+, shortest match

:+

0 or 1, shortest match

:-

Table B.3. Repeat # metacharacters.

Position Metacharacters

Position metacharacters specify where a character, set, or metacharacter is to appear in relation to other characters. They can also be used in a Find expression to move the insertion point without selecting any text. Table B.4 lists the Position metacharacters (all of which appear on the Position menu in the Find/Replace dialog box).

Description

PowerFind

PowerFind Pro

Character on Left:

:<

Character on Right:

:>

Word Start

\<

Line Start

:^

¶ Start

^

Document Start

:s

Word End

\>

¶ End

$

Document End

:e

Table B.4. Position metacharacters.

524 Match Metacharacters

The Match metacharacters allow you to group parts of your Find expression together and to refer to any or all of the “found” text later in the Find/Replace expression. They also allow you to use the contents of any clipboard in a Find/Replace expression. Table B.5 lists the metacharacters from the Match menu and a few additional characters available in PowerFind Pro.

Description

PowerFind

PowerFind Pro

Current Clipboard

\CC

Clipboard #0 to #9

to

\C0 to \C9

Found (or selected) item

&

(

\(

)

\)

(, no replacement1

:(

), no replacement1

:)

…Found 1 through …Found 9

through

\1 through \9

…Found 10 through …Found 63

\E10 through \E63

Note:
1These parentheses function just like regular parentheses except that they do not create a Replace expression that can be referred to later.

Table B.5. Match metacharacters.

Search Options

The search options in Table B.6 can be used as arguments of Find/Replace (and related commands) in a macro. See Chapter 12 for more detailed instructions. Appendix D lists the variants of Find/Replace along with the proper syntax for using them in macros.

525

Option

Meaning

Equivalent Control or Menu Command

a

Replace All

Replace All button

A

Wrap Around

Search Whole File (Find/Replace menu) or Whole File checkbox checked

-A

Don’t Wrap Around

Search Whole File (Find/Replace menu) or Whole File checkbox unchecked

C

Copy Find (and/or Replace) expression (and all search options) to Find/Replace dialog box without performing a search

Copy to Find, Copy to Replace (Edit menu)

e

PowerFind expression

PowerFind (Find mode pop-up)

E

Jump to end of document if nothing found

g

PowerFind Pro expression

PowerFind Pro (Find mode pop-up)

-e (or -g)

Find Literal (This option is needed only if PowerFind Pro is selected as your default Find method in the Finding Preferences dialog box.)

Normal Find (Find mode pop-up)

G

Search all open documents

Search All Open Files (Find/Replace menu)

-G

Search front document only (same as -M, -m)

Search Active File (Find/Replace menu)

i

Ignore Case

Ignore Case (Find/Replace menu) or Ignore Case checkbox checked

I

Index (instead of Replace)

Index (Replace mode pop-up)

l

Replace All in the current paragraph only

526 M (or m)

Use Search List

Search Search List (Find/Replace menu)

-M (or -m)

Search active document only (same as -G)

Search Active File (Find/Replace menu)

n

Select last text changed after a Replace All within the current selection (requires either s or l to be used)

o

Find text only

Text Only checkbox for Find box; Find Text Only (Find/Replace menu) checked

-o

Find is attribute-sensitive

Text Only checkbox for Find box; Find Text Only (Find/Replace menu) unchecked

O

Replace text only

Text Only checkbox for Replace box; Replace Text Only (Find/Replace menu) checked

-O

Replace is attribute-sensitive

Text Only checkbox for Replace box; Replace Text Only (Find/Replace menu) unchecked

r

Reverse (search toward beginning of document)

“Up” arrow in Find/Replace dialog

s

Replace All in current selection

In Selection button (option-Replace All)

S

Find is script-sensitive

Find Script Sensitive (Find/Replace menu) checked

-S

Find is not script-sensitive

Find Script Sensitive (Find/Replace menu) unchecked

t

Terse (no dialog box displayed if nothing found)

T

Terminate macro if nothing found

v

Verbose (display number of items found/replaced)

527 w

Whole Word

Whole Word checkbox checked

-w

Not whole word

Whole Word checkbox unchecked

W

Wrap Around (same as A)

Search Whole File (Find/Replace menu) or Whole File checkbox checked

-W

Don’t Wrap Around (same as -A)

Search Whole File (Find/Replace menu) or Whole File checkbox unchecked

X

Use with Find Next to place the pathnames of files on the search list onto the clipboard

(Option-d)

Ignore Diacriticals

Ignore Diacriticals (Find/Replace menu)

® (Option-r)

Root of Word

Root of Word (Find/Replace menu) (Hebrew/Arabic/Farsi only)

¢ (Option-4)

Find aleph with all nikkudot (Hebrew only)

1

(Option-2)

Find yaa’ with all diacriticals (Arabic only)

1

ƒ (Option-f)

“Sounds Like” find

Sounds Like (Find/Replace menu) checked

*

Use options currently selected in Find/Replace dialog box (must be first option listed if used).

Note:
1These commands appear on the Find/Replace menu only when a right-to-left language is installed.

Table B.6. Search options.

Copyright © 1995, 1996, 1999 by Joe Kissell

< Appendix A | Appendix C >