本帖最后由 zhkqy 于 2013-12-13 09:23 编辑
- import java.util.regex.*;
- import java.io.*;
- public class Test1 {
- public static void main(String[] args) throws IOException {
- BufferedReader br = new BufferedReader(new FileReader("F:\\share\\123456.html"));
- String line = "";
- while ((line = br.readLine()) != null) {
- parse(line);
- }
- }
- 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());
- }
- }
- }
复制代码
代码如上,可是运行后不显示任何东西,为什么啊?
|