in reply to Find Replace into a subroutine
Of course it can be be re-factored.
Have you even tried to re-factor the code? If you haven't why should someone else do it for you?