Allow sed() replacement to be a function.

I have made a very simple change to sed() to allow the replacement to be a function, and I have added a unit test.

Thank you for a very useful library.

Cheers.