如何提取文本文件或者网页里面的email地址?最好能够速度比较快的。比如如下地址:[email protected]>, "闫立国" <[email protected]>, "闫成至" <[email protected]>, "闫超" <[email protected]>, "佟志强" <[email protected]>, "邹力新" <[email protected]>, "紫怡书吧(转大明收)" <[email protected]>, "庄小霞" <[email protected]>, "祝毓敏" <[email protected]>, "诸奇亮" <[email protected]>, "朱月楼" <[email protected]>,  "朱耀庭" <[email protected]>,  "朱彦昭" <[email protected]>, "朱新华" <[email protected]>, "朱巍" <[email protected]>, "朱清华" <[email protected]>, "朱建路" <[email protected]>, 

解决方案 »

  1.   

    procedure TForm1.Button1Click(Sender: TObject);
    var
       i,j:Integer;
       lg,lt:Integer;
       List1,List2,List3:TStrings;
    begin
       List1:=TStringList.Create;
       List2:=TStringList.Create;
       List3:=TStringList.Create;
       List2.LineBreak:=',';
       List1.LoadFromFile('d:\2.txt');
       for i := 0 to List1.Count - 1 do
       begin
          List2.Text:=List1[i];
          for j := 0 to List2.Count - 1 do
          begin
             lt:=Pos('<',List2[j]);
             lg:=Pos('>',List2[j]);
             if (lt>=0)and(lg>=0) then
             begin
                List3.Add(Copy(List2[j],lt+1,lg-lt-1));
             end;
          end;
       end;
       List3.SaveToFile('d:\1.txt');
    end;
      

  2.   

    ..还要加上
         List1.Free;
        List2.Free;
        List3.Free;
      

  3.   

    我说的是举个例子,若是不规则的,其他的代码,比如网页里面,怎么提出email
      

  4.   

    网页取源码进行分析,用IDhttp Get 就行
      

  5.   

    最快也就是正则了,在别的语言里面都是首选。Delphi默认没有正则库,但是搜索一下可以找到的。
      

  6.   

    这类问题正则是最好的了 RegExpr.pas 开源的delphi正则单元