How to create and deploy an ordinary function (not a sql/mr function) in Aster

Aster

How to create and deploy an ordinary function (not a sql/mr function) in Aster

I would like to create a regexp_replaceAll funciton, but as a regular database function, not an sql/mr function.

Aster has a built-in regexp_replace function which is inadequate for my needs.