An algorithm to regularize static spherically symmetric black hole spacetimes