php 字符串 正则表达式
才在学习php,现在遇到一个$contents变量里面的内容如下 document.write('
width=60 style=max-width:90% align=absbottom src=other%20web_files/slogo-news.gif
border=0> target=_blank>教育新闻
href=http://news.ycwb.com/2014-02/08/content_6034510.htm
target=_blank>川大教授张兴栋当选美国国家工程院外籍院士 金羊网 06:29
href=http://news.xinhuanet.com/edu/2014-02/08/c_126099001.htm
target=_blank>北京推一本高招计划 定向投放生态涵养区 新华网 09:11
target=_blank>肇庆:主要景区迎客221万人次 光明网 08:29
target=_blank>把对故乡眷恋藏心里 春节后娃娃随父母出发 组图 新华网 08:47
href=http://news.xinhuanet.com/edu/2014-02/08/c_119240720.htm
target=_blank>促进高校毕业生就业有哪些新的改革举措 新华网 10:18
target=_blank>借力“适应性学习” knewton演绎在线教育变革 搜狐 09:55
href=http://www.sd.xinhuanet.com/news/2014-02/08/c_119235535.htm target=_blank>山东为自费留学中介上紧箍
严禁到中小学招生 新华网山东频道 08:03
target=_blank>西汉“学术超男”策划“诗经秀”取功名 人民网 07:04
target=_blank>李鸿章哥哥摆架子被下级痛骂 人民网 07:04
target=_blank>江苏金坛教育系统工作“贴地行走”摸准基层脉 中国教育新闻网 08:50
target=_blank>更多>>
');
现在想把里面的这样的内容 href=http://news.ycwb.com/2014-02/08/content_6034510.htm
target=_blank>川大教授张兴栋当选美国国家工程院外籍院士 筛几条出来,请问应如何操作。
回复讨论(解决方案) 筛几条 是指哪几条?这个标准怎么定义?
$str=content;preg_match_all(#.*?#is, $str, $matches);print_r($matches);
$str=content;preg_match_all(#.*?#i, $str, $matches);print_r($matches);
$s =<
');txt;//全部 a 标记preg_match_all('#
感谢版主的回答,正则表达式也看过,没想到能这么用,完全解决了我的问题,知道我的需求,大师就是大师哦