Repeat set – Nisus Writer Pro User Manual

Page 328

Advertising
background image

308

Using PowerFind

Finding and Replacing Text

NotFollowedBy() and NotPrecededBy()

Similar to!FollowedBy() and PrecededBy() neither NotFollowedBy() nor
NotPrecededBy() “capture” anything. Think of them as a nested!expression (or
perhaps a “grouped”, “sub”, or “contained” expression). These each require that
the nested expression to not be present. In other words, they are zero-width and
do not contribute to the full match. They function like the start/end of line
anchors (“$” and “^”) but allow somewhat arbitrary expressions. Only
NotFollowedBy() allows arbitrary expressions. NotPrecededBy() requires the
subexpression to be fixed in width, or some combination of fixed width
expressions.

CharacterInSet[] Any one or more characters, for example: vowels
CharacterNotInSet[]

Any one or more characters, for example: anything not a Tab

Repeat set

Use the Repeat set options to find a character or wild card that appears a specified number of
times. To find parts of strings, be sure to uncheck Whole Word. You cannot use Repeat options in
the Replace expression. To replace something you find with a certain number of items in the
Replace box you must enter them that many times. (Remember, you can cut copy and paste in the
Find/Replace window.)
Repeat menu commands refer to repeated occurrences of a character or wild card. Zero or one
occurrences means that the character or string is either not found or found only once; there is no
repeat. For example, the expression

(find any A followed by any B which may or may not

be there), finds each occurrence of A alone or A preceding any number of B’s.

0 or 1

Zero or one occurrence

The expression illustrated in Figure 337 (find any A or any A followed by any B but only the first
one that appears) finds A in AC and AB in ABB.

Figure 337

The “0 or 1” PowerFind expression

0 or 1 Shortest

Zero or one occurrence, the shortest occurrence

The expression illustrated in Figure 338 (find any A followed by any B which must be there at
least one (or more) time(s), but only the shortest string of them) finds only AB regardless of how
many B’s appear.

Figure 338

The “Shortest 0 or 1” PowerFind expression

0+

Zero or more repeated occurrences (“It may or may not be there.”)

0+ Shortest

Zero or more repeated occurrences (“It may or may not be there.”), the shortest
occurrence

1+

One or more repeated occurrences

The expression illustrated in Figure 339 (find any A followed by any B which must be there at
least one (or more) time(s)).

1+ Shortest

One or more repeated occurrences, the shortest occurrence

Figure 339

The “1+” PowerFind expression

Advertising