Add replace-all, replace-first and prune functions.