这样的php正则表达式该怎么编?我需要提取具体数据那部分内容,代码如下:

提取出4.313.2610.7875.92164.503.3440.28空(有些是空的数据)<trclass=""><tdclass="noborderbright">2... 提取出4.31 3.26 10.78 75.92 164.50 3.34 40.28 空(有些是空的数据)
<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);
展开
 我来答
百度网友b127745f2
2013-05-06 · TA获得超过1923个赞
知道小有建树答主
回答量:179
采纳率:100%
帮助的人:211万
展开全部

<?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);

?>

推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式