正则问题
两个例子:
86AA4NP4210950SM
86AAUWPB2112507E
求红色部分的结果。
我写的正则:
<!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
-->preg_match_all('/([a-zA-Z0-9][\w\s]{1}\w{2})\w{2}(\d{4})\w{4}/',$s1,$r1);
print_r($r1);
$stra='86AA4NP4210950SM'; $strb='86AAUWPB2112507E'; $a = substr($stra,2,4); $b = substr($stra,8,4); <br><font color="#e78608">------解决方案--------------------</font><br>最啊,不是很规律吗,<br>从第3个字符substr到第6个<br>再从第9个substr到12不就完事了吗 <div class="clear"></div>
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号