| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 | 31 |
- 네트워크
- JavaScript
- ssh
- Source
- Quartz
- xargs
- port
- VirtualBox
- plugin
- bash
- import
- GIT
- lsof
- 단축키
- Windows
- maVen
- find
- Mac
- Windows 10
- grep
- netsh
- resource
- context
- web.xml
- vscode
- Eclipse
- IntelliJ
- tomcat
- 줄바꿈 문자
- profile
- Today
- Total
develog
정규표현식 #1 본문
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class TestMain {
public static void main(String[] args) {
System.out.println("START");
System.out.println("-------------------------------------");
String str = "<a href='javascript:void(0);' onclick='skip_navigation('content');'>본문 영역으로 바로가기</a>";
System.out.println("str : " + str);
String regex = "<.*?>";
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(str);
String ret = null;
while (matcher.find()) {
System.out.print(" ");
System.out.print(matcher.start() + ", " + matcher.end());
System.out.print(", " + str.substring(matcher.start(), matcher.end()));
System.out.println();
ret = str.replaceAll(regex, "");
}
System.out.println("ret : " + ret);
System.out.println("-------------------------------------");
System.out.println("END");
}
}
'Dev > Java' 카테고리의 다른 글
| logger.error (0) | 2013.05.29 |
|---|---|
| [Java] log4j, add appender in source code (0) | 2013.05.29 |
| [java] html tag 제거 (0) | 2013.05.26 |
| Collection List<Map> sort (0) | 2013.05.16 |
| Web scraper open source (0) | 2013.05.16 |