CONTENTS | INDEX | PREV | NEXT
SYNTAX : ARG @:R / STRING 1 / STRING 2 /
: ARG @:R / / STRING 2 /
RESULTING ARGUMENT: -1 (all or some of the requested changes were made)
0 (no changes were made)
FUNCTION : Replace a character string by another character string
as many times as specified, or as many times as the first
character string exists (whichever is smaller). Search
starts at the current position in the buffer. After
execution, the cursor (and implicitly the value of . )
is positioned immediately after the last string replaced.
The modification character (delimiter) immediately
follows the command in the command sequence. This
character will be used instead of the ESC in the normal
replace command. This character is followed by the first
string, which is terminated by the modification
character. The second string follows, which is in turn
terminated by another identical modification character.
A negative argument forces backward search in the buffer.
In these cases, the cursor is positioned before the last
string replaced (counting backwards!).
ARGUMENT : The number of times to perform the replace-action.
DEFAULT : 1
EXAMPLE : 0 u0 < @:r / hello / ESC / ; %0 >
Will replace the string hello by an ESC in a loop. The
value of register 0 contains the number of replacements.
Note, that this is a very ineffective way to do this!
The same could be done by entering
h @r / hello / ESC / u0
as command.
NOTE 1 : Search-behaviour is governed by the Search Mode setting
(see CTRL_X)
NOTE 2 : If the first string is empty (as in @:r / / world /)
then the previous search string is reused.
NOTE 3 : The search string (used for both search and replace
commands) is accessable in register _ at all times.
NOTE 4 : The modification character is arbitrary. It must not
occur in either search- or replacement string.
NOTE 5 : Not finding a match does not raise an error condition.
NOTE 6 : The RETURN character is allowed anywhere in the search-
or replacement string.
MATRIX