Ignoring the problems mentioned by Dennis07 regarding comments:
Delphi-Quellcode:
function ReplaceBetweenTags(const Source, TagStart, TagEnd, ReplaceWith: string): string;
var
posEnd: Integer;
posStart: Integer;
begin
posStart := Source.IndexOf(TagStart) + TagStart.Length;
posEnd := Source.IndexOf(TagEnd, posStart);
Result := Source.Substring(0, posStart) + ReplaceWith + Source.Substring(posEnd);
end;