Hola McK.
Estoy de acuerdo con Neftali, se necesitan dos ciclos.
Pero mas eficiente que usar dos for es:
Código Delphi
[-]
function ExtractNum(Sub, Str: string): TStrings;
var
i, p: Integer;
begin
Result:= TStringList.Create;
p:= 1;
while p <> 0 do
begin
p:= Pos(Sub, Str);
if p > 0 then
begin
Inc(p, Length(Sub));
i:= 1;
while Str[p + i] in ['0'..'9'] do Inc(i);
Result.Add(Copy(Str, p, i));
Inc(p, i);
Str:= Copy(Str, p, MaxInt);
end;
end;
end;
Ejemplo de llamada:
Código Delphi
[-]
procedure TForm1.Button1Click(Sender: TObject);
const
Cadena = 'HGL44DHS274HGL23JHGL41234HGL412YGHGL555XADSF1AHG12HGL999';
begin
Memo1.Lines:= ExtractNum('HGL', Cadena);
end;
Saludos.