Home > php教程 > php手册 > php preg_match_all正则匹配字符串所有连接地址

php preg_match_all正则匹配字符串所有连接地址

WBOY
Release: 2016-05-25 16:57:05
Original
1166 people have browsed it

php教程 preg_match_all正则匹配字符串所有连接地址
*/

$str ='<a href="http://www.a.com/2010/11-15/5.html">4</a>
  <a href="http://www.b.com/2010/11-15/6.html">5</a>
  <a href="http://www.b.com/2010/11-15/1.html">6</a>
Copy after login


  ';

$ymd=date("y")."/".date("m-d");
$b = preg_match_all('/<a href="(.*?)com/'.%24ymd.'(.*?)html">(.*?)</a>/',$a,$c,preg_set_order);
Copy after login

/*

int preg_match_all ( string $pattern , string $subject , array &$matches [, int $flags [, int $offset ]] );搜索所有匹配正则表达式的模式并提出给予他们在比赛中受的标志指定的顺序。第一场比赛后发现,随后的搜查是继续从最后一场比赛结束。


更多详细内容请查看:http://www.phprm.com/phper/php-cy/33670.htm

本文地址:

转载随意,但请附上文章地址:-)

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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template