Ragazzi, tempo fa avevo già fatto (ma non trovo) del codice che permetteva di estrarre da un file tutti gli url e tutte le mail. Ci ho sbattuto un po la testa, ma non mi funziona. Chi mi aiuta?
function TForm1.GetUrl(sito: string): string;
var
CodicePag: string;
regex: TRegExpr;
i: integer;
begin
codicepag:='http//www.lazaruspascal.it http://www.liuheschool.com ';
regex:=TRegExpr.Create;
try
regex.Expression:='\b(?:(?:https?|ftp|file)://|www\.|ftp\.)[-A-Z0-9+&@#/%=~_|$?!:,.]*[A-Z0-9+&@#/%=~_|$]';
if RegEx.Exec(CodicePag) then
begin
for i:=1 to regex.SubExprMatchCount do
Memo1.Append(regex.Match[i]);
end;
finally
regex.Free;
end;
memo1.Append('finito') ;
end;