The strslice command can be used to extract part of a string. The left and right keywords are used to specify the start direction for the extracted string slice. The offset specifies the number of characters to skip from the start direction. The character count specifies the number of characters to extract. A value of 0 for the character count extracts the entire remaining portion of the string. The extracted string replaces the original string contained in the variable.
The syntax is
|
Some examples are
|
The regexreplace command replaces parts of a string with another string based on a regular expression pattern. This is similar to the substitution operation in Perl. The regex pattern specifies the regular expression pattern to search for in the original string. The replacement text specifies the string to substitute when a match is found. The match options specify other conditions that affect a match. The available match options are:
i perform a case insensitive match
g match all occurances of a pattern
Note that for the regular expression pattern string, a \ character must be preceeded by another \.
The syntax is
|
Some examples are
|
The replacement text can also contain backreferences. Backreferences are specified using $1 for the subexpression matched in the first parenthesis, $2 for the subexpression matched in the second parenthesis and so on.
Some examples are
|