![]()  | 
	
 
  | 
| 
		 
			 
			#1  
			
			
			
			
		 
		
		
	 | 
|||
		
		
  | 
|||
| 
	
	
		
			
			 Не могу понять в чём дело. Должно со всего текста по регулярке добавлять результат в ListBox. 
		
	
		
		
		
		
		
	
		
		
	
	
	Выдаёт ошибку: TRegExpr(exec): No Input String Specified. Код: 
	unit Unit1;
interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, RegExpr;
type
  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    ListBox1: TListBox;
    OpenDialog1: TOpenDialog;
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
var
  Form1: TForm1;
  r: TStringList;
  RegExp: TRegExpr;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
  i: Integer;
begin
 for i:= 1 to r.Count do
 begin
  RegExp:= TRegExpr.Create;
  RegExp.Expression:= '"key":"(.*?)"';
 if RegExp.Exec(i) then
 begin
 repeat
  ListBox1.Items.Add(RegExp.Match[1]);
 until not RegExp.ExecNext;
 end;
 end;
  Button1.Caption:= 'Готово!';
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
  OpenDialog1.Filter:= 'Text file|*.txt';
  OpenDialog1.InitialDir:= ExtractFilePath(Application.ExeName);
 if OpenDialog1.Execute then
 begin
  r.LoadFromFile(OpenDialog1.FileName);
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
  r:= TStringList.Create;
end;
end. |