Php regular expression to obtain the tag href in the div tag. php regular expression to obtain the tag href in the div tag. & lt; divclass & quot; zx_list_l & quot; & gt; & nbsp; & lt; ul & gt; & nbsp; & lt; li & gt; & nbsp; & lt; ahref & quot; xxx & quot; target & quot; _ bl php regular expression to obtain the tag href in the p tag
Php regular expression to obtain the tag href in the p tag
There are many
The tag is not what I want. All I want is in the p tag.
A connection
If you use regular expressions, you must first obtain the content in p.
- A tag connection
Effect:
Array
(
Http://news.cjcp.com.cn/2012/0917/4316066.html
Http://news.cjcp.com.cn/2012/0917/4316065.html
Http://news.cjcp.com.cn/2012/0917/4316064.html
Http://news.cjcp.com.cn/2012/0917/4316063.html
[4] => http://news.cjcp.com.cn/2012/0917/4316062.html
Http://news.cjcp.com.cn/2012/0917/4316061.html
Http://news.cjcp.com.cn/2012/0917/4316060.html
)
------ Solution --------------------
PHP code
$str=<<
txt;preg_match('/
(.*)<\/p>/isU',$str,$m);preg_match_all('/