updated regexp to match without leading newlines