|
- The characters "
?#{}+\" are special. To use them
literally, precede them with the escapement character
"\'. - Replacement strings may just be a literal string or they may
include the "ditto" character "
?'. The ditto character will
copy the character in the position specified in the
replace-string from the same position in the located expression. - A decimal digit placed within curly-braces (eg:
{5})
will place that character of the located expression to the output. - A "
\" followed by a number will place that subexpression to the
output. Subexpressions are numbered starting at 1. - A plus-character "
+" will place an incrementing decimal number
to the output. One purpose of this operator is to number lines. - A "
#" followed by a number will cause the numbered
subexpression to be printed in hexadecimal form. - Any character in the replace-string may be represented by the
hexadecimal value of that character using the following syntax:
\xhh where hh is the hexadecimal value.
EXAMPLE
<$data = "Roses are red" "Violets are blue">
<$expr = "blue" "red">
<$replace = "you" "dead">
<sandr $expr $replace $data>
<LOOP $ret>
$ret
</LOOP>
The output would be:
Roses are dead
Violets are you
CAVEATS The sandr function was added Aug. 23 1996.
The replacements occur in the order of values in $expr, so
a later $expr might match a previous $replace value.
SEE ALSO
rex, split
Copyright © Thunderstone Software Last updated: Mon Feb 18 10:28:15 EST 2013
|