string xsh:subst(string STR,string REGEXP,string REPLACEMENT, [string OPTIONS])


Acts in the very same way as perl substitution operation STRING =~ s/REGEXP/REPLACEMENT/OPTIONS, returning the resulting string. Searches a string for a pattern, and if found, replaces that pattern with the replacement text. If the REPLACEMENT string contains a $ that looks like a variable, the variable will be interpolated into the

REPLACEMENT at run-time. Options are:

e - evaluate REPLACEMENT as a Perl expression,

g - replace globally, i.e., all occurrences,

i - do case-insensitive pattern matching,

m - treat string as multiple lines, that is, change ^ and $ from matching the start or end of the string to matching the start or end of any line anywhere within the string,

s - treat string as single line, that is, change . to match any character whatsoever, even a newline, which normally it would not match,

x - use extended regular expressions.