Asi takto nejako (pseudo-pascal):
Kód:
var Del: Boolean;

Del:=False;
while not Eof(In) do
 begin
   ReadLn(In,S);
   if UpCaseStr&#40;Copy&#40;S,1,4&#41;&#41;='<DIV' and Copy&#40;S,Pos&#40;'NAME=',UpCaseStr&#40;S&#41;&#41;, Length&#40;S&#41;-1&#41; in WantToDelete then Delete&#58;=True;
   if UpCaseStr&#40;S&#41;='</DIV>' then Delete&#58;=False;
   if not Del then WriteLn&#40;Out,S&#41;;
 end;