function GetTextInPercent(aLine: string): string; var i1, i2: Integer; begin i1 := Pos('%', aLine) + 1; i2 := PosEx('%', aLine, i1); Result := Copy(aLine, i1, i2 - i1); end; procedure TForm1.Button4Click(Sender: TObject); var k: integer; begin for k:=0 to memo1.Lines.Count-1 do begin Que1.Lines.Text := Que1.Lines.Text + GetTextInPercent(Memo1.Lines.Strings[k]); end; end; There is a procedure that allows you to search in the Memo text the symbol '%' and output after it everything that is after it until the same '%' is found. But this only works if characters are on a single line.
How to make to display several lines?
Sample text in Memo (Memo1):
In the spring, the snow quickly melted, the water rose and flooded the beaver's hut. The beavers dragged the beaver onto dry leaves, but the water crept even higher, and the beavers had to spread to different directions. (Snegiryov G.)%
Example result in another Memo (Que1):
In the spring, the snow quickly melted, the water rose and flooded the beaver's hut. The beavers dragged the beaver onto dry leaves, but the water crept up even higher, and the beavers had to spread in different directions. (Snegirev G.)