Home > Backend Development > PHP Tutorial > 跪求正则匹配出来上面的内容,研究很久无结果

跪求正则匹配出来上面的内容,研究很久无结果

WBOY
Release: 2016-06-13 10:59:28
Original
1082 people have browsed it

跪求正则匹配出来下面的内容,研究很久无结果。
html代码内容如下:

<div class="brandItem-info"><br />      <div class="bIi-brand  j_BrandItemInfo "><br />        <p class="bIi-brand-logo"><br />                                        <a target="_blank" href="http://evaouxiu.tmall.com"><img   data-ks-lazyload="http://img02.taobaocdn.com/tps/i2/T1lXzTXdRoXXXQXDnq-90-45.png_120x120.jpg"    style="max-width:90%" width="90" alt="品牌名" /></a><br />          <strong>Eva Ouxiu/伊华&middot;欧秀</strong><br />        </p><br />        <dl class="bIi-style clearfix"><br />          <dt>品牌描述:</dt><br />          <dd>街头;通勤;女装;</dd><br />        </dl><br />        <p>月总销量:5702件</p><br />                              <p class="bIi-intro j_BrandItemIntro">时尚商务生活方式的代表,适合帅气干练、优雅性感的都市女性穿着参加会议谈判、休闲聚会、宴会Party。</p><br />               </div><br />      <p class="bIi-addBtn"><br />        <a class="ui-btn-m j_CollectBrand" data-brandId="95516990"> 关注该品牌</a> 			</p><br />    </div>
Copy after login


需要PHP正则把"
"开始到结束的内容匹配出来。
谢谢。
------最佳解决方案--------------------
<br />preg_match('/<div class="brandItem-info">(.*)<\/div>/is',$str,$mat);<br />print_r($mat[1]);<br />
Copy after login

啊?
------其他解决方案--------------------

引用:
PHP code

preg_match('/
(.*)/is',$str,$mat);
print_r($mat[1]);


啊?
试了不行,因为忘记告诉你是上面代码是一个html中,后面还有很多内容。http://brand.tmall.com/categoryIndex.htm?industryId=110&categoryId=50031407&etgId=91&page=1  获取这个地址里面的品牌。信息
------其他解决方案--------------------
引用:
引用:

PHP code

preg_match('/
(.*)/is',$str,$mat);
print_r($mat[1]);


啊?

试了不行,因为忘记告诉你是上面代码是一个html中,后面还有很多内容。http://brand.tmall.com/categoryIndex.……

正则答案:
preg_match_all('/
(.*?)/ism',$content1,$mat);
print_r($mat);

感谢franzhong
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