Function Regex-Replace

Part of:

package cl-ppcre
( regex-replace < regex > < target-string > < replacement > &key < start > < end > < preserve-case > < simple-calls > < element-type > )

Try to match TARGET-STRING between START and END against REGEX and
replace the first match with REPLACEMENT.

REPLACEMENT can be a string which may contain the special substrings
“\&” for the whole match, “`” for the part of TARGET-STRING
before the match, “\'” for the part of TARGET-STRING after the
match, “\N” or “{N}” for the Nth register where N is a positive
integer.

REPLACEMENT can also be a function designator in which case the
match will be replaced with the result of calling the function
designated by REPLACEMENT with the arguments TARGET-STRING, START,
END, MATCH-START, MATCH-END, REG-STARTS, and REG-ENDS. (REG-STARTS and
REG-ENDS are arrays holding the start and end positions of matched
registers or NIL - the meaning of the other arguments should be
obvious.)

Finally, REPLACEMENT can be a list where each element is a string,
one of the symbols :MATCH, :BEFORE-MATCH, or :AFTER-MATCH -
corresponding to “\&”, “`”, and “\'” above -, an integer N -
representing register (1+ N) -, or a function designator.

If PRESERVE-CASE is true, the replacement will try to preserve the
case (all upper case, all lower case, or capitalized) of the
match. The result will always be a fresh string, even if REGEX doesn't
match.

ELEMENT-TYPE is the element type of the resulting string.