Hallo,
Du kannst ja mal folgenden probieren:
Delphi-Quellcode:
type
TForm1 = class(TForm)
Memo1: TMemo;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private-Deklarationen }
FRegEx : TPerlRegEx;
procedure RegExMatch (Sender : TObject);
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.RegExMatch (Sender : TObject);
begin
ShowMessage (FRegEx.MatchedText)
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
FRegEx := TPerlRegEx.Create;
try
FRegEx.Subject := UTF8Encode (Memo1.Lines.Text);
FRegEx.Options := [preCaseLess];
FRegEx.RegEx := '(?<=(?<!(''TEMPLATE_INSERT_|''TEMPLATE_INSERT_))) %%(script|)_[a-z]+_[a-z0-9]+%%';
FRegEx.OnMatch := RegExMatch;
if FRegEx.Match then
repeat
until not FRegEx.MatchAgain;
finally
FreeAndNil (FRegEx)
end
end;
[EDIT]
FRegEx.RegEx := '(?<=(?<!(''TEMPLATE_INSERT_|''TEMPLATE_INSERT_))) %%(script|)_[a-z]+_[a-z0-9]+%%';
Ist zwar nicht falsch, aber
FRegEx.RegEx := '(?<=(?<!(''TEMPLATE_INSERT_))) %%(script|)_[a-z]+_[a-z0-9]+%%';
einmal reicht aus.
[/EDIT]
Gruß