Replace text replacing algorythm to avoid tag attributes and specific tags