Performs substitutions based on regular expression pattern matching. For an explanation of all POSIX regular expression operators see the documentation of GNU regexp.
Prototype:
string <-- regsub ( exp , from , by )
This operator matches the regular expression exp against from, and it copies from to the string result. If there is a match, then while copying from to the string result the portion of from that matched exp is replaced with by. If by contains a ``&'' or ``\0'', then it is replaced in the substitution with the portion of string that matched exp. If by contains a ``\n'', where n is a digit between 1 and 9, then it is replaced in the substitution with the portion of from that matched the n-th parenthesized subexpression of exp. Additional backslashes may be used in by to prevent special interpretation of ``&'' or ``\0'' or ``\n'' or backslash. The use of backslashes in by tends to interact badly with the mtsgmlql interpreter's use of backslashes, so you need to double all backslashes.
Only the first match is replaced.
Examples:
This oper@tor matches the regular expression exp against from
Prototype:
string <-- regsuball ( exp , from , by )
This operator matches the regular expression exp against from, and it copies from to the string result. If there is a match, then while copying from to the string result the portion of from that matched exp is replaced with by. If by contains a ``&'' or ``\0'', then it is replaced in the substitution with the portion of string that matched exp. If by contains a ``\n'', where n is a digit between 1 and 9, then it is replaced in the substitution with the portion of from that matched the n-th parenthesized subexpression of exp. Additional backslashes may be used in by to prevent special interpretation of ``&'' or ``\0'' or ``\n'' or backslash.The use of backslashes in by tends to interact badly with the mtsgmlql interpreter's use of backslashes, so you need to double all backslashes.
All matches are replaced.
Examples:
This oper[ta]or m[ta]ches the regul[ra] expression
exp [ga][ia]nst from