to 楼上:非常正确!
我结合我的土法
function TFrm_Main.get_mp_mail(s: string; i: integer): string; //mp ëÅß
begin
result := copy(s, i - 21, 40);
end;
function TFrm_Main.get_qj_mail(s: string): string; //qj Çó¾«
var i: integer; tmp1, tmp2: string;
begin
i := pos('@', s);
result := '';
if i = 0 then exit;
tmp1 := copy(s, 1, i - 1);
tmp2 := copy(s, i + 1, 21);
if trim(tmp1) = '' then exit;
i := length(tmp1);
while i > 0 do
begin
if (tmp1 = #$A) and (TMP1[I - 1] = #$D) then BREAK;
if tmp1 = ' ' then break;
if tmp1 = '.' then break;
if tmp1 = ':' then break;
if tmp1 = '£º' then break;
if ord(tmp1) > 122 then break;
if ORD(TMP1) < 46 then BREAK;
if TMP1 = '/' then BREAK; //47
if (ORD(TMP1) >= 58) and (ORD(TMP1) <= 64) then BREAK;
if (ORD(TMP1) > 90) and (ORD(TMP1) < 95) then BREAK;
if (ORD(TMP1) = 96) then BREAK;
i := i - 1;
end;
tmp1 := copy(s, i + 1, length(tmp1)-i);
i := 1;
while length(tmp2) > i do
begin
if tmp2 = ' ' then break;
if tmp2 = ':' then break;
if tmp2 = '@' then break;
if tmp2 = '&pound;&ordm;' then break;
if ord(tmp2) > 126 then break;
if ORD(TMP2) < 46 then BREAK;
if TMP2 = '/' then BREAK; //47
if (ORD(TMP2) >= 58) and (ORD(TMP2) <= 64) then BREAK;
if (ORD(TMP2) > 90) and (ORD(TMP2) < 95) then BREAK;
if (ORD(TMP2) = 96) then BREAK;
i := i + 1;
end;
tmp2 := copy(tmp2, 1, i - 1);
result := tmp1 + '@' + tmp2;
result := lowercase(result);
if rightstr(result, 1) = '.' then result := '';
if rightstr(result, 1) = '@' then result := '';
end;
function TFrm_Main.GetAllMail(value: string): tstrings;
var
s, mail: string; len, i: integer;
begin
result := tstringlist.Create;
s := value;
i := pos('@', s);
len := length(s);
while i > 0 do
begin
i := pos('@', s);
len := len - (i + 1);
mail := get_mp_mail(s, i);
mail := get_qj_mail(mail);
if mail <> '' then result.Add(mail);
s := copy(s, i + 1, len);
end;
end;