채택완료
내용중 캡션 이 부분만 정규직으로 이용해서 추출 할려고 합니다만 ㅠ,ㅠ
Copy
<p><table align="center" class="__se_tbl_ext" id="news_image" style="border: 1px solid rgb(210, 210, 210); border-image: none; margin-top: 15px; margin-bottom: 15px;" border="0" cellspacing="0" cellpaddin="0"> <tbody> <tr> <td> <div style="margin: 8px;"> <img width="500" align="absmiddle" src="http://주소/PEG/14346989125161.jpg"> // 사진 부분 </div> <div id="news_caption" style="padding-right: 8px; padding-left: 8px;"> ▲3333 // 캡션부분 </div> </td> </tr> </tbody></table><p> </p><p> </p> <p> <table align="center" class="__se_tbl_ext" id="news_image" style="border: 1px solid rgb(210, 210, 210); border-image: none; margin-top: 15px; margin-bottom: 15px;" border="0" cellspacing="0" cellpaddin="0"> <tbody> <tr> <td> <div style="margin: 8px;"> <img width="500" align="absmiddle" src="http://주소/PEG/14346989037433.jpg"> // 사진 부분 </div> <div id="news_caption" style="padding-right: 8px; padding-left: 8px;"> ▲22222 // 캡션부분 </div> </td> </tr> </tbody> </table><p> </p><p> </p> <p> <table align="center" class="__se_tbl_ext" id="news_image" style="border: 1px solid rgb(210, 210, 210); border-image: none; margin-top: 15px; margin-bottom: 15px;" border="0" cellspacing="0" cellpaddin="0"> <tbody> <tr> <td> <div style="margin: 8px;"> <img width="375" align="absmiddle" src="http://주소/PEG/14346988935636.jpg"> // 사진 부분 </div> <div id="news_caption" style="padding-right: 8px; padding-left: 8px;"> ▲1111 // 캡션부분 </div> </td> </tr> </tbody> </table> <p> </p> <p> </p> <p> </p>
위에 소스는 $_POST('content') 에 담아 져 있는데요. 위에 빨간색만 추출 하고 싶습니다.
출추 하고 싶은 부분은
캡션 (ex: 1111)
이부분만 추출 해서 각각 배열로 담을 할려고 합니다.
정규직의 대한 지식이 없는 저로써 어떻게 할지 몰라 이렇게 글을 남김니다.
부탁드립니다 ㅠ,ㅠ
답변 1개 / 댓글 1개
채택된 답변
+20 포인트
2015-06-22 (월) 12:54:18
preg_match_all('#<div id="news_caption"[^>]+>([^<]+)#', $str, $m);
답변에 대한 댓글 1개
답변을 작성하려면 로그인이 필요합니다.