The fn:replace() function now allows $0 in the replacement string but
the error message still says:
An error is raised [invalid replacement string] if the value of
$replacement contains a "$" character that is not immediately followed
by a digit 1-9 and not immediately preceded by a "\".
Change 1-9 to read 0-9.
Michael Kay