All substrings replaced
substitute_all/4 replaces in "string" all substrings defined by "regexp" with "substitution". The modified string is returned in "result".
regexp atom string atom substitution atom result atom
substitute_all('a(.)', barbara, '%1a', L).
==> L = brabraa
Whatever is bracketed is assigned to a term. Whatever is bracketed by
the from left to right i-th opening bracket is assigned to the i-th
term. Bracketed terms can be referenced in substitute/4 and
substitute_all/4 with %1...%9 in the substitute expression.
This predicate is not part of the ISO-Prolog Standard.