SubstSubst — applies a substitution pattern to a string of a given
length.
static Regex.Subst(pattern, subject, length?=-1)
patternA substitution pattern, in the form
s/pattern/substitution/flags.
subjectThe subject string on which the substitution will be made.
lengthThe length of the subject string. Entering -1
(the default) for this parameter will cause the length of the
subject string to be automatically computed.
On success, returns the new string with the substitutions applied. On failure, an error list with three elements:
String replacement:
Gamma>x = "This is a test of my test system""This is a test of my test system"Gamma>Regex.Subst("s/test/build/g", x)"This is a build of my build system"
To surround all words with parentheses:
Gamma>Regex.Subst ("s/(\\w+)/\\($1\\)/g", "This is a test!");"(This) (is) (a) (test)!"