s/SUM(\d*)/sum($1)/eg [download]
In reply to Re: Subroutines in a regex? by busunsl in thread Subroutines in a regex? by heidkamp