[問題] PHP抓原始碼內容

作者: SABER101 (None)   2011-08-04 11:41:09
http://www.epinions.com/review/Canon_PowerShot_SX210_IS_Digital_Camera/content_536777166468
想從上面網址抓中間Review部分
Review是在本文位置
<span class=rkr>
本文
<br>
表達式這樣寫<span class=rkr>\s(.*)\s<br>
完全抓不到東西
然後\s(.*)\s<br>這樣抓到文章九成
剩下這段抓不到
Straight photography (Street, documentary, and environmental portraiture) is
primarily concerned with capturing images of people in uncontrived, naturally
lit and candid settings that evocatively depict or dramatically reveal some
aspect of the human condition. In addition to being a first rate general
purpose digicam, the nifty little SX210 is almost perfect for “straight”
photography - it is compact, responsive, unobtrusive, features a 14x zoom
(for a little extra standoff room) and dependably generates first rate images.
明明就有寫換行為什麼會抓不到在同一行的這一段
然後第一個和第二個的差別只差<span class=rkr>
然後就全沒了?????
好苦惱啊
希望有人能解答
謝謝
作者: scp958630 (日立安)   2011-08-04 11:53:00
/<span class=rkr>(.*?)<b>Recommended:/s從<span class=rkr>到文字中間有不只一個\n\s只能match到一個 你可以用\s*或是 加s modifier讓.包含\n
作者: SABER101 (None)   2011-08-04 17:43:00
用s modifier會從第一個<span class=rkr>開始抓的說
作者: blackkaku (black)   2011-08-04 21:02:00
<span class=rkr>\n +\n(.+<br>)$ 抓\1

Links booklink

Contact Us: admin [ a t ] ucptt.com