일치하지 않는 나는 다음과 같은 HTML이 있습니다정규식은 와일드 카드
<tr><td><font color="#306eff">P: </font>9283-1000<font color="#306eff">
또는 내가 regexpal.com에 가서 다음과 같은 정규식 입력
<tr><td><font color="#306eff">P: </font>9283-1000
<font color="#306eff">
(줄 바꿈) :
P: </font>(.*?)<font
을 그리고 그것은 일치합니다. 나는 자바에서 그것을 할 때, 그것은 일치하지 않습니다
Pattern rP = Pattern.compile(">P: </font>(.*?)<font");
Matcher mP = rP.matcher(data);
if (mP.find()) {
System.out.println(mP.group(1).trim());
}
내가 다른 경우에 시도 여러 정규 표현식에이 있고 그들은 단순히 자바에서 작동하지 않습니다. 어떤 제안? 감사!
자바는 자체 REGEX입니다 – Keerthivasan
[대신 HTML 구문 분석기 사용] (http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags?answertab=oldest # tab-top) – Reimeus