Home > Backend Development > PHP Tutorial > 求正则表达式写法解决方法

求正则表达式写法解决方法

WBOY
Release: 2016-06-13 12:58:29
Original
958 people have browsed it

求正则表达式写法
字符串如下: 
  

8.
北京诚安堂药房有限公司古城分店
京DB0700088
李伯军
北京市石景山区古城大街北京物美商业集团股份公司古城分店内
零售

    -->

我想提取中间的以下字符串"北京诚安堂药房有限公司古城分店","京DB0700088","北京市石景山区古城大街北京物美商业集团股份公司古城分店内"
请问该怎么写?
------解决方案--------------------
<?php<br />
<br />
$str = " <tr class=\"searchtabledark\"><td align=\"center\">8.</td><br />
<td><a href='leechdom_busentprise_detail.jsp?rule_id=odp_3_15247'>北京诚安堂药房有限公司古<br />
城分店</a></td><br />
<td><a href='leechdom_busentprise_detail.jsp?rule_id=odp_3_15247'>京DB0700088</a></td><br />
<td>李伯军</td><br />
<td>北京市石景山区古城大街北京物美商业集团股份公司古城分店内</td><br />
<td align=\"center\">零售</td><br />
<td><br />
    -->";<br />
<br />
preg_match_all("#>([^<]+)<#", str_replace("\n", '', $str), $matches);<br />
<br />
print_r($matches);<br />
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