1 Import Java. Io. bufferedreader; 2 Import Java. Io. filenotfoundexception; 3 Import Java. Io. filereader; 4 Import Java. Io. ioexception; 5 Import Java. util. RegEx. matcher; 6 Import Java. util. RegEx. pattern; 7 8 9 Public Class Emailspider { 10 11 /** 12 * @ Author Zhw 13 * @ Param ARGs 14 */ 15 Public Static Void Main (string [] ARGs ){ 16 17 Try { 18 Bufferedreader BR = New Bufferedreader ( New Filereader ("111.txt" )); 19 String line = "" ; 20 21 While (Line = Br. Readline ())! = Null ){ 22 23 Parse (line ); 24 25 } 26 27 BR. Close (); 28 } Catch (Filenotfoundexception e ){ 29 // Todo auto-generated Catch Block 30 E. printstacktrace (); 31 } Catch (Ioexception e ){ 32 // Todo auto-generated Catch Block 33 E. printstacktrace (); 34 } 35 36 37 } 38 39 Private Static Void Parse (string line ){ 40 41 Pattern P = pattern. Compile ("[\ W [.-] + @ [\ W [.-1] + \. [\ W] +" ); 42 Matcher M = P. matcher (line ); 43 While (M. Find ()) 44 System. Out. println (M. Group ()); 45 46 47 } 48 49 }