테스트 사이트 - 개발 중인 베타 버전입니다

php 정규식 질문있습니다.. preg match.. 채택완료

스카이라인 11년 전 조회 4,826

 

<span id="husky_bookmark_end_1410417964480"></span></p><p> </p><ol class="hglt_code" style="font-size: 13.3333339691162px; padding: 0px; width: 621px; color: rgb(172, 172, 172); font-family: 'Courier New', Courier, monospace; line-height: 24.5555572509766px; margin: 0px !important; background-image: url(<a href="http://static.naver.net/kin/09renewal/bg_hglt_y.gif);" target="_blank" rel="noopener noreferrer">http://static.naver.net/kin/09renewal/bg_hglt_y.gif);</a> background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: -67px 0px; background-repeat: repeat-y;"><li style="margin: 0px; padding: 0px 0px 0px 33px; list-style: none; position: relative; font-size: 12px; line-height: 22px; vertical-align: top;"><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px 12px; font-family: 'Courier New', Courier, monospace; color: rgb(51, 51, 51); vertical-align: top; white-space: pre-wrap; zoom: 1;"><td <span class="key" style="margin: 0px; padding: 0px; font-weight: bold; color: rgb(139, 0, 89);">class</span>=mw_basic_view_subject> </pre></li><li class="even" style="margin: 0px; padding: 0px 0px 0px 33px; list-style: none; position: relative; font-size: 12px; line-height: 22px; vertical-align: top;"><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px 12px; font-family: 'Courier New', Courier, monospace; color: rgb(51, 51, 51); vertical-align: top; white-space: pre-wrap; zoom: 1; background-color: rgb(250, 250, 250);"><!----> </pre></li><li style="margin: 0px; padding: 0px 0px 0px 33px; list-style: none; position: relative; font-size: 12px; line-height: 22px; vertical-align: top;"><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px 12px; font-family: 'Courier New', Courier, monospace; color: rgb(51, 51, 51); vertical-align: top; white-space: pre-wrap; zoom: 1;">가져올텍스트             </td> </pre></li><li class="even" style="margin: 0px; padding: 0px 0px 0px 33px; list-style: none; position: relative; font-size: 12px; line-height: 22px; vertical-align: top;"><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px 12px; font-family: 'Courier New', Courier, monospace; color: rgb(51, 51, 51); vertical-align: top; white-space: pre-wrap; zoom: 1; background-color: rgb(250, 250, 250);"></tr> </pre></li></ol><p>

 

 

여기서 가져올테스트를 뽑아오고 싶은데요..

 

/\.*(.*)?.*<\/td>/ 

이것도 안되고요..

/class=mw_basic_view_subject>(.*)[^]<\/td>/s

이것도 안되고요..​ 두번째것으로 하면 ​ 이것도 가져오고.. 뒤에 이상한것들도 같이 따라오네요;;

 

ㅠㅠ 완전 초보라서요.. 도움좀 부탁드립니다...

댓글을 작성하려면 로그인이 필요합니다.

답변 2개

simple_html_dom.php를 쓰면서 저는 

find()함수를 사용합니다.

$page -> find('td[class=mw_basic_view_subject]');

이런식으로 말이지요

로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

스카이라인
11년 전
simple_html_dom.php는 어떻게 쓰는거죠? 같은 루트에 올려서 쓰면 되는건가요? 아니면 .. /extend 이런데 넣고 하는건가요?ㅠㅠ 현재 snoopy로 preg_match 해서 사용중이거든요..

댓글을 작성하려면 로그인이 필요합니다.

11년 전

echo strip_tags($str); 

로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

스카이라인
11년 전
preg_match('/<td class=mw_basic_view_subject>(.*)[^<td>]<\/td>/s', $sn->results, $text);
echo $text[1];

이런식으로 가져오려고 하는데요.. 어디다 붙여 넣죠?ㅠㅠ..

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인