代码如下

package Game;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {
    public static void main(String[] args) throws IOException {
        File file=new File("D:\\index.html");
        BufferedReader buf=new BufferedReader(new InputStreamReader(new FileInputStream(file)));
        String str=null;
        String regex="(.)+@(.)+(\\.[a-z]+){1,}";
        Pattern pattern=Pattern.compile(regex);
        while((str=buf.readLine())!=null)
        {
            Matcher matcher=pattern.matcher(str);
            while(matcher.find())
            System.out.println(matcher.group());
        }
        buf.close();

    }
}

  详细说明:http://java.662p.com/thread-3731-1-1.html

相关文章:

  • 2022-12-23
  • 2021-07-23
  • 2021-04-30
  • 2021-09-20
  • 2021-08-03
  • 2021-07-21
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-07-02
  • 2021-07-22
  • 2021-11-26
  • 2021-04-23
  • 2022-12-23
  • 2021-10-20
  • 2021-04-04
相关资源
相似解决方案