fixing pre tag trim issue, using initial optional spacing in regex instead