clearing first blocks from dynamically inserted templates - made regex less greedy