php使用表正则表达式获取HTML内容
<tr>
<td>英镑</td>
<td>GBP</td>
<td>一周</td>
<td>887.236046</td>
<td>902.325146</td>
<td>894.780596</td>
<td>2019-03-15</td>
</tr>
<tr>
<td>英镑</td>
<td>GBP</td>
<td>二十天</td>
<td>887.805366</td>
<td>903.052566</td>
<td>895.428966</td>
<td>2019-03-15</td>
</tr>
我想截取第三个<td>标签中的内容,求个php正则,谢了!
$str = "
tool.chinaz.com|888<tr>
<td>英镑</td>
<td>GBP</td>
<td>一周</td>
<td>887.236046</td>
<td>902.325146</td>
<td>894.780596</td>
<td>2019-03-15</td>
</tr>
<tr>
<td>英镑</td>
<td>GBP</td>
<td>二十天</td>
<td>887.805366</td>
<td>903.052566</td>
<td>895.428966</td>
<td>2019-03-15</td>
</tr>
";
$rex = '/tr>.+?<td>.+?<td>.+?<td>(.+?)</td>/is';
preg_match_all($rex, $str, $match);
print_r($match[1]);
输出结果:
Array
(
[0] => 一周
[1] => 二十天
)