gensub() completely in awk,
using match() and substr(). Call the function
gensub2(), and put any helper functions into the gensub2
namespace, while keeping the gensub2() function in the awk
namespace.
Provide tests in a BEGIN rule.
The author’s solution is included in gawk distribution.