티스토리 뷰
package getemail;
import java.io.IOException;
import java.util.HashSet;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.jsoup.Connection;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
public class GetEmailAddr {
static String url="https://newsis.com/view/?id=NISX20200623_0001068975&cID=10101&pID=10100";
public static void fillEmailsHashSet(String line,HashSet<String> container){
Pattern p = Pattern.compile("([\\w\\-]([\\.\\w])+[\\w]+@([\\w\\-]+\\.)+[A-Za-z]{2,4})");
Matcher m = p.matcher(line);
while(m.find()) {
container.add(m.group(1));
}
}
public static void main(String[] args) throws IOException {
Connection.Response response = Jsoup.connect(url)
.method(Connection.Method.GET)
.execute();
Document d = response.parse();
//System.out.println(d);
String s=d.toString();
HashSet<String> hs = new HashSet<>();
fillEmailsHashSet(s, hs);
for (String string : hs) {
System.out.println(string);
}
}
}
'자바(Java) > 어플리케이션' 카테고리의 다른 글
[java] 자바 wav 소리 플레이 실행 하는 방법 (0) | 2020.07.07 |
---|---|
[java] 자바 디렉토리 모니터링 (0) | 2020.07.06 |
[java] 자바 smtp (gmail smtp 버전) (0) | 2020.07.03 |
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- 인포믹스
- MySQL
- ocajp
- 플러터
- KG
- JDBC
- EC
- 자바 smtp
- 파이썬
- proc
- C
- xe애드온
- 포인터
- webix
- esql
- 이클립스
- XE
- 문자열
- ocjap
- C언어
- xe addon
- Python
- 라이믹스 모듈
- 자바
- XE3
- 오라클
- 스크래핑
- php
- 파싱
- 프로씨
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
글 보관함