package twentyfive;
import java.io.BufferedReader;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class eight {
public static void main(String[] args) {
mailsss();
}
public static void mailsss()throws Exception
{
BufferedReader br=new BufferReader(new FileReader("mail.txt")) ;
String line=null;
String mailreg="\\w+@\\W+(\\.\\W+)+";
Pattern p=Pattern.compile(mailreg);
while((line=br.readLine())!=null)
{
Matcher m=p.matcher(line) ;
while(m.find())
{
System.out.println(m.group());
}
}
}
}
BufferedReader br=new BufferReader(new FileReader("mail.txt")) ;这句话有错误请问该怎么解决,还有mail.txt数据源应放在哪里,这个数据源照着
相关 数据抄一份写成.txt的形式行吗?
|