这样的php正则表达式该怎么编?我需要提取具体数据那部分内容,代码如下:
<trclass="">
<tdclass="noborder bright">2013/05/03 09:56(初)</td>
<tdclass="bright">赛前2小时3分</td>
<tdclass="bright"><spanclass="bluetxt">4.31↓</span></td>
<tdclass="bright"><spanclass="bluetxt">3.26↓</span></td>
<tdclass="bright"><spanclass="redtxt">10.78↑</span></td>
<tdclass="bright"><spanclass="redtxt">75.92↑</span></td>
<tdclass="bright"><spanclass="redtxt">164.50↑</span></td>
<tdclass="bright">3.34→</td>
<tdclass="bright"><spanclass="redtxt">40.28↑</span></td>
<tdclass="bright"></td>
</tr>
谢谢!还有就是怎么将若干数组按对应键值组合成新数组?如以下数组:
$a = array( [0] => 5.06 [1] => 4.15 [2] => 7.72 [3] => 40.44 [4] => 112.18);
$b = array( [0] => 5.10 [1] => 4.10 [2] => 7.62 [3] => 39.75 [4] => 110.27);
$c = array( [0] => 5.13 [1] => 4.11 [2] => 7.56 [3] => 38.73 [4] => 107.92);
希望得到的新数组为:
$na = array( [0] => 5.06 [1] => 5.10 [2] => 5.13);
$nb = array( [0] => 4.15 [1] => 4.10 [2] => 4.11);
$nc = array( [0] => 7.72 [1] => 7.62 [2] => 7.56);
$nd = array( [0] => 40.44 [1] => 39.75 [2] => 38.73);
$ne = array( [0] => 112.18 [1] => 110.27 [2] => 107.92); 展开
<?php
$a = '<trclass="">
<tdclass="noborder bright">2013/05/03 09:56(初)</td>
<tdclass="bright">赛前2小时3分</td>
<tdclass="bright"><spanclass="bluetxt">4.31↓</span></td>
<tdclass="bright"><spanclass="bluetxt">3.26↓</span></td>
<tdclass="bright"><spanclass="redtxt">10.78↑</span></td>
<tdclass="bright"><spanclass="redtxt">75.92↑</span></td>
<tdclass="bright"><spanclass="redtxt">164.50↑</span></td>
<tdclass="bright">3.34→</td>
<tdclass="bright"><spanclass="redtxt">40.28↑</span></td>
<tdclass="bright"></td>
</tr>';
preg_match_all('/"bright">(<[^>]*>)?([0-9.]*).*/' , $a , $b);
$b = $b[2];
array_shift($b);
print_r($b);
?>