I've searched Google and these forums, found some documentation on TRegExpr, and still haven't found an example of how to do this.
Basically I want to change this: <http://www.google.com>, <http://www.facebook.com>
Into HTML like this: <a href="
http://www.google.com">
http://www.google.com</a>, <a href="
http://www.facebook.com">
http://www.facebook.com</a>
That is, I want to replace all instances of a match. Here's my code so far.
Program test;
uses Regexpr;
var tre,ts:string;
Regex:TRegexpr;
done:boolean;
begin
tre:='<(http://|ftp://|mailto:).+>';
Regex.Expression :=tre ;
//if Regex.Exec(ts) then
done:=false;
while (not done) do
if Regex.Exec(ts) then
ts:=ReplaceRegExpr(tre, ts, '<a href="$&">$&</a>', True)
else
done:=true;
writeln('TS='+ts);
end. // End program
Surely someone has done this before. In Perl I use the 'g' modifier.
Thank you!