Modifier characters, Parenthesized expressions, Abcdefabghababcdababcdef – Nisus Writer Pro User Manual
Page 340: Abcd

320
Using PowerFind Pro
Finding and Replacing Text
Modifier characters
Use the modifier characters backslash and colon to change how Nisus Writer Pro interprets what
follows them.
\
the backslash
In PowerFind Pro, the backslash changes the meaning of the character or characters that follow it.
For example the character n, is not a metacharacter and has no special meaning. However, \n
represents the New Line character in an expression.
Parenthesized expressions
Use parentheses in PowerFind Pro Find expressions in the same manner as you do with PowerFind
with these additional guidelines.
The ( ) characters in PowerFind Pro correspond to the Capture expression found in the Match menu
in PowerFind and explained on page 307. For example, the search for (my expression) (where my
expression represents some text such as the airplane) continues as if the ( and ) were not present.
Nisus Writer Pro then remembers the matched expression, that is, the Found or Captured#
expression that fits the parameters of the expression my expression. To refer to the first
parenthesized expression again in the Find what expression or in the Replace with expression, use
the metacharacter \1, this is the PowerFind Pro equivalent to PowerFind’s
or
.
Use parentheses to include repeated characters in one expression, then append a repeat
metacharacter such as +. For example, the expression (AB)+ finds AB followed by AB repeated one
or more times in succession.
You can refer to strings of text you have found in any Find expression even within that same Find
expression, but you must first place that segment of the Find expression in parentheses in order to
refer to it later. For example the text:
ABCDEFABGHABabcdABabcdEF
has only five patterns repeated in its twenty-four characters.
{ { {
{
{
1
2
3
4
5
ABCDEFABGHABabcdABabcdEF
Figure 357
Repeated text patterns
Nisus Writer Pro can find each of these patterns with the Find expression
(AB)([[:upper:]]+?)(EF)\1([[:upper:]]+?)\1([[:lower:]]+?)\1\5\3
Rearranging the Replace expression (and adding various attribute formatting options):
\2\4
\5
\1
\2
\3
\3
\1
\5
\5
\2
\1
\4
arrives at this result:
CDGH
abcd
AB
CD
EF
ef
AB
abcd
abcd
cd
AB
GH
Nisus Writer Pro can ignore, or not “capture” some of the expressions it finds.
The metacharacters used in the PowerFind expression for AnyWord ((?:\m\w+\M)) “(?:” and “?)”
have the exact same function as ( and ) except that they do not create a replace expression (i.e. \1,
\2, \3, etc.). These allow you to search for a particular string of text without creating a
corresponding Replace with expression. You can use these for grouping other metacharacters
together to apply a single modifier to them. For example in the pattern in Figure 357 above:
Figure 358
Uncaptured text patterns
(AB)(?:[[:upper:]]+?)(EF)\1([[:upper:]]+?)\1([[:lower:]]+?)\1\4\2
Rearranging the Replace expression (and adding various attribute formatting options):
\2\4
\1
\2
\3
\3
\1
\2
\1
\4
arrives at this result:
EFabcd
AB
EF
GH
gh
AB
ef
AB
abcd