Slightly modified Stefan's beautiful routine. If I did not screw it up, it's faster because of comparing against the stack (parameters aChar1, aChar2), (I can't explain that), and omitting "sr" leaves more register for the compiler, which was a speed boost again.
Also, the initial "while" became a "repeat until", and instead of "P^ = #0" there is a " P = ep".
function ExtractContent4(const S: string; const aChar1, aChar2: Char): string;
var
P, ep, r: PChar;
len: integer;
begin
len := S.Length;
if len = 0 then
exit(S);
SetLength(Result, len);
r := Pointer(Result);
P := Pointer(S);
ep := P + len;
repeat
r^ := P^;
if P^ = aChar1 then
begin
repeat
inc(P);
until (P^ = aChar2) or (P = ep);
end
else
inc(r);
inc(P);
until P > ep;
SetLength(Result, r - Pointer(Result));
end;