before replacing tag search