开发者

What's wrong with this preg_match_all

I'm using file_get_contents to read a .html file that has a ta开发者_运维技巧ble.

<table id="someTable" style="width:100%;margin-bottom:0;">
    <tr style="display:none;">
        <td style="padding-left:25px;">Some text</td>
    </tr>
    <tr style="display:none;">
        <td style="padding-left:25px;">another text</td>
    </tr>
</table>

When I use preg_match_all to read the table, I get nothing when I count $matches[1]

preg_match_all('/<table id="someTable" style="width:100%;margin-bottom:0;">(.*)<\/table>/', $html, $matches);
$co = count($matches[1]);


Add modifier s to your preg_match.

preg_match_all('/<table id="someTable" style="width:100%;margin-bottom:0;">(.*)<\/table>/s', $html, $matches);

See http://ideone.com/3w0K2

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜