import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class EmailSpider {
public static void main(String[] args) {
BufferedReader br=null;
try {
br = new BufferedReader(new FileReader("D:"+ File.separator +"test.htm"));
String line = null;
while((line=br.readLine()) != null) {
parse(line);
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if(br != null ){
try {
br.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
private static void parse(String line) {
Pattern p = Pattern.compile("[[\\w]+_*]+@[\\w]+[\\.[\\w]+]+");
Matcher m = p.matcher(line);
while(m.find()) {
System.out.println(m.group());
}
}
}
EmailSpider
最新推荐文章于 2019-05-27 13:42:16 发布