Home >Backend Development >PHP Tutorial >问个正则匹配的有关问题

问个正则匹配的有关问题

WBOY
WBOYOriginal
2016-06-13 10:02:34869browse

问个正则匹配的问题
$url   =   'http://www.ltjxw.com/sca_tlist.asp?scasort=2 ';  
$file   =   file($url);  
$html   = " ";
foreach($file   as   $item   ){
$html.=$item;
}
$begin   =   "分类列表 ";$end   =   "7910条信息 ";

$str   =   '/([^分类列表]*) '.$begin. '([^7910条信息]*) '.$end. '/is ';

$re   =   preg_match   (
$str,
$html,
        $out);
print_r(   $out   );
echo   $re;
#(1)我想先截取网页中从“分类列表”   到   “7910条信息”之间的内容
#(2)然后再从结果中截取相关信息   该怎么做   是不是有什么\0   \1之类的

------解决方案--------------------
/分类列表((?:.|\n|\r)*)7910条信息/isU

Statement:
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