s = ~s/zz*/oz/
Again, a few options can be given after the closing slash. They are m for multi-line, i for ignoring case, and g for finding all matches.
s = ~s/zz*/oz/
To apply a regular expression substitution, use it as function. It doesn't alter the argument string (like any Shang function), but returns an updated copy of the string, which can be assigned to the same variable if one wishes.
text = "Monkey in the zzoo" s = ~s/zz*/oz/ text = s(text)A regular expression substitution s has the following attributes
The pattern and options attributes can be accessed and modified, and the match attribute is a function that matches the pattern against the argument string.