求助一个正责
我要匹配一段内容
要得到这一段内容必须要 用 或者 连接2个匹配前的字符串。但是我不知道怎么联
- HTML code
<!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
-->
<th class="left">股市名称</th>
<th>最新</th>
<th>涨跌幅%</th>
td class='left' width='72'>
<div>纳斯达克</div></td>
上面是内容,
现在我要得到
股市名称 最新 涨跌幅% 纳斯达克
我写了一个正责:
preg_match_all('/
但是不能用。
还请看一看。
------解决方案--------------------
- PHP code
$value=<<<html
<th class="left">股市名称</th>
<th>最新</th>
<th>涨跌幅%</th>
<td class='left' width='72'>
<div>纳斯达克</div></td>
html;
preg_match_all('/(<th[^>]*>|<div>)(.*)(<\/th>|<\/div>)/isU', $value,$strs);
print_r($strs[2]); <div class="clear">
</div>










