1
在標題A觀察,這裏的HTML代碼示例:preg_match_all搶
<body>
<!--CODE_START-->
<p>I <strong>Want</strong> this</p>
<p>And this one too</p>
<!--CODE_STOP-->
<p>This sould be go to trash</p>
<!--CODE_START-->
<p>This one should be included too</p>
<!--CODE_STOP-->
的問題是,我想裏面的東西<!--CODE_START-->
和<!--CODE_STOP-->
所以結果應該是:
<p>I <strong>Want</strong> this</p>
<p>And this one too</p>
和<p>This one should be included too</p>
我試着用這個/<!--CODE_START-->([^<]*)<!--CODE_STOP-->/
和/<!--CODE_START-->(.*)<!--CODE_STOP-->/
結合了patter n修飾符如su
,imu
,im
它不起作用,只返回一個空數組。還有,我試圖抓住它的完整HTML頁面。
在此先感謝。
對不起,我忘了把這個,我一直前試試這個,但它只是一樣的,有一個空的數組結果。 – pengemizt
Ups,我只是犯了一個錯字!大聲笑它效果很好!謝謝! – pengemizt