正则表达式抓取网页中邮箱

2018-01-09  本文已影响0人  jsjack_wang
1.废话不说,看代码
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class EmailRegexDemo {

    private static final String TARGET_URL = "http://tieba.baidu.com/p/2314539885";

    public static void main(String[] args) {
        try {
            String content = HttpUtils.get(TARGET_URL, null);
            Matcher matcher = Pattern.compile(PatternUtils.EMAIL_REGEX).matcher(content);
            while (matcher.find()) {
                System.out.println(matcher.group());
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}   

代码地址(码云):https://gitee.com/jsjack_wang/JavaDemo
上一篇下一篇

猜你喜欢

热点阅读