Php 什么';这场预赛怎么了
我正在使用Php 什么';这场预赛怎么了,php,preg-match,preg-match-all,Php,Preg Match,Preg Match All,我正在使用file\u get\u contents读取一个包含表格的.html文件 <table id="someTable" style="width:100%;margin-bottom:0;"> <tr style="display:none;"> <td style="padding-left:25px;">Some text</td> </tr> <tr style="displ
file\u get\u contents
读取一个包含表格的.html
文件
<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>
将修饰符
s
添加到预匹配中
preg_match_all('/<table id="someTable" style="width:100%;margin-bottom:0;">(.*)<\/table>/s', $html, $matches);
preg_match_all('/(.*)/s',$html,$matches);
请参见使用正则表达式解析HTML几乎肯定不是一条可行之路。你希望实现什么目标?
preg_match_all('/<table id="someTable" style="width:100%;margin-bottom:0;">(.*)<\/table>/s', $html, $matches);