Replacement regex bug fix