Step by step for a working install (from the download link you provided in the comments to the original question):
Extract the Zip file into a folder. I used E:\Code\PerlRegEx\XE2
, because I have a non-Unicode version installed for D2007 already.
Start a new console project with File->New->Other->Console App
.
Use Project->Options->Compiler
from the IDE's main menu, and add the path location from above into the Search Path
. Paste the following code to replace everything in the Code Editor:
program Project2;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils, PerlRegex;
var
Regex: TPerlRegex;
begin
try
Regex := TPerlRegex.Create;
try
Regex.Subject := 'This is a test of TPerlRegex';
Regex.RegEx := '\btest\b';
if Regex.Match then
WriteLn('Found match: ' + Regex.MatchedText)
else
WriteLn('Can''t be! No match found!');
ReadLn;
finally
Regex.Free;
end;
except
on E: Exception do
Writeln(E.ClassName, ': ', E.Message);
end;
end.
As you can see, I've used a very complex test of the functionality of TPerlRegex
for this test case. :-)
If the above works for you, and you're still having problems in your own project:
Check your old project for a reference to an old version of TPerlRegex (another folder in the search or library path, an entry in Tools->Options->Environment->Library Path).
Check the uses clause (you can use Search->Find in Files, check All Files in Project) for PerlRegex.
Make sure you followed the exact steps above: Add PerlRegex's folders to your Project->Compiler->Search Path settings, add PerlRegex to the uses clause of the unit you want to use it in. If it works in the code from my example on your machine, but doesn't in your other project, the problem is there
one of them
have you downloaded ? Could you include the exact link to the version you've used ? – TLamaTPerlRegEx
. – David Heffernan