Fixed empty replace string bug in regex.