[請益] preg_match_all抓不到資料

看板PHP作者 (皮卡~)時間15年前 (2010/10/11 22:11), 編輯推噓3(301)
留言4則, 3人參與, 最新討論串1/1
我想要抓http://0rz.tw/QsPhN的新聞 用 preg_match_all('/class=\"news_title\">(.+?)<\/span>/',$content,$newsti); 有抓到標題 可是 preg_match_all('/<div id=\"newsc\" class=\"news_content\">(.+?)<\/div>/'...... 卻一直抓不到新聞內容 從原始檔怎麼看都是包在 <div id="newsc" class="news_content"> </div> 中間... print_r出來都是空的 請問我這樣寫問題是在哪呢? 謝謝<(_ _)> -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 134.208.38.182

10/11 22:51, , 1F
.不含換行 改用'/<div>(.+?)<\/div>/s'
10/11 22:51, 1F

10/12 06:40, , 2F
(.+?)>(.*)
10/12 06:40, 2F

10/12 22:37, , 3F
http://www.weitz.de/regex-coach/ 拿來測一下火星文
10/12 22:37, 3F

10/12 22:38, , 4F
確定一下你設定的正規表示式能選到你想要的內容
10/12 22:38, 4F
文章代碼(AID): #1CinilFO (PHP)
文章代碼(AID): #1CinilFO (PHP)