Home > Backend Development > PHP Tutorial > 难:求一段代码的正则,该怎么解决

难:求一段代码的正则,该怎么解决

WBOY
Release: 2016-06-13 10:28:17
Original
915 people have browsed it

难:求一段代码的正则
这2段代码是在html中,把html通过file_get_contents下载下来后提取其中的数据,网页地址:http://rate.taobao.com/user-rate-39512.htm


第一个是:提取其中的a标签中的 5810
5810

第二个是:提取其中的a标签中的 23510
23510

------解决方案--------------------

PHP code
[User:root Time:19:35:14 Path:/home/liangdong/php]$ cat preg.php <?php $str = <<<EOF<a href="#" class="J_show_list J_MakePoint" data-point-val="tbrate.2.2.1" data-param='timeLine=-7&result=1'>5810<a href="#" class="J_show_list J_MakePoint" data-point-val="tbrate.2.3.1" data-param="timeLine=-30&result=1">23510</a>EOF;preg_match_all('/<a. j_makepoint>(.*)/iUs', $str, $matches);print_r($matches);?><div class="clear">
                 
              
              
        
            </div></a.>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template