7.0;s (substitute) *DM*, revision 7.0, 83/08/16
S (SUBSTITUTE) -- Substitute all occurrences of matched string in defined range.
usage: [range]s[[/[string1]]/string2]
FORMAT
[range]S[[/[string1]]/string2/]
The S command substitutes one literal string for a string described by a
regular expression over a defined text range. The command does not move the
cursor or the window, but does update the window when the substitution is
completed. Strings used with this command are also saved for later use (see
below).
All substitutions are case sensitive, unlike searches, which ignore case
unless told otherwise. Substitution case sensitivity cannot be disabled.
ARGUMENTS
If no arguments are specified, the previous substitution will be repeated from
the current cursor position to the end of the line.
range
(optional) Specify range of text in which substitution is to be made.
Type HELP DM RANGE for details.
Default if omitted: use current cursor position to end of
line
string1
(optional) Specify string to be replaced in the form of a regular
expression. If this argument is omitted but the opening
delimiter (/) is used (i.e., "S//string2/"), then string1
defaults to the string1 used in the last SEARCH operation.
If the delimiter is also omitted (i.e., "S/string2/"), then
string1 defaults to the string used in the last
SUBSTITUTION operation.
Default if omitted: see above
string2
(optional) Specify literal replacement string. This is NOT a regular
expression). An "&" can be used to denote string1. If
'string1' is present, then 'string2' is required.
Default if omitted: repeat last substitution command
EXAMPLES
1. CTRL/T Move to first character in the pad.
<MARK> Place a mark.
CTRL/B Move to last character in the pad.
<CMD> s/Fielding/Tom Jones/ Replace the string "Fielding" with
"Tom Jones" throughout the marked
range (in this case, the entire pad).
2. <CMD> s/Tom/& Jones/ Replace "Tom" with "Tom Jones".
Since no range was marked or specified,
the replacement takes effect from
the current cursor position to the
end of the line.
RELATED TOPICS
More information is available. Type:
- HELP DM RANGE
for details about text editing ranges.
- HELP DM COMMANDS
for a list of other pad editing commands
- HELP PATTERNS
for details about regular expressions.