question about regexp

From: jck11 (jck11_at_msr.pchome.com.tw)
Date: 11/30/04


Date: Tue, 30 Nov 2004 16:59:16 +0800

Hi all
I want to get digitals from a text by the code below.
But when I run the program , I get the error message
'TRegExpr(exec):ExecNext without Exec[Pos]'
What's wrong with me?

Thanks for your helping
ps. download regexpr.pas from http://regexpstudio.com/TRegExpr/TRegExpr.html

procedure TForm1.Button1Click(Sender: TObject);
var
  reg: TRegExpr;
  i: integer;
begin
  reg:= TRegExpr.Create;
  try
    reg.Expression:= '[\d]+';
    for i:= 0 to memo1.Lines.Count - 1 do begin
      reg.exec(memo1.lines.Strings[i]);
      repeat
        memo2.lines.add(reg.match[0]);
      until not reg.execnext;
    end;
  finally
    reg.Free;
  end;
end;


Quantcast