$msar([c][i][g][r]/[<search>/<replace>/]*<text>)
The arguments are composed of:
c
, i
, g
, and r
,c
, i
, g
, or r
, and is customarily a forward-slash,<search>
) that may not contain the delimiter to be removed,<replace>
) that may not contain the delimiter to be inserted in place of (3a),<text>
) that MAY NOT contain the delimiter to be transformed.
No matter what, <text>
is always the text that follows the final delimiter.
If properly formed, there should always be an odd number of delimiters in
the arguments. But if there is an even number of delimiters, this would
result in a substutition with a <search>
but no <replace>
. This <search>
would be ignored as a syntax error.
In its simple form, the string <text>
is returned with the first instance
of each of the <search>
strings replaced with each of the corresponding
<replace>
strings. The matching of <search>
is case-insensitive by default.
The options modify this behavior:
c | The search for <search> should be case-sensitive. |
i | The search for <search> should be case-insensitive (this is the default, and the option is only included for backwards-compatibility). |
g | All instances of <search> should be replaced with <replace> . You must be careful that the contents of <replace> do not match <search> because this would cause it to be infinitely replaced. |
r | The <text> argument is the name of a variable. The search and replace is performed on the value of this variable, and the result is assigned back to the variable. |
the resultant string
$msar(/as/xy/asdf) returns "xydf" $msar(/as/xy/yd/42/asdf) returns "x42f" $msar(/e/he/pi/ll/c/o/epic) returns "hello"