帮助写一个小正则
类似的数据格式为:0,37
$str = '0,37
<?php $str='0,355</td><td class="Pdata">9500</td><td class="Pdata">11000</td><td class="Pdata">72,5</td>bla...';
preg_match_all('/(?:<td class="Pdata">(.*?))+/s',$str,$matchs);
echo $matchs[1][0];
<br><font color="#e78608">------解决方案--------------------</font><br><fieldset>
<legend>探讨</legend>
<br><br>72,5 可能是 0,355</fieldset>
</td><td class="Pdata">9500</td><td class="Pdata">11000</td><td class="Pdata">这样的格式<br><br><font color="#e78608">------解决方案--------------------</font><br><fieldset>
<legend>探讨</legend>
<br>这里哪有你前面说的72,5这样的格式呢?难道是0,355了?<br>
</fieldset>
<br><font color="#e78608">------解决方案--------------------</font><br>莫非这样?<br><br>试试差多少<br><dl class="code">PHP code<pre class="brush:php;toolbar:false;">
preg_match("/.*>([\d,]+)/", $str, $m);
echo $m[1];
<br><font color="#e78608">------解决方案--------------------</font><br>可以 的
<br><font color="#e78608">------解决方案--------------------</font><br>
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号