Home > Backend Development > PHP Tutorial > 帮忙写个正则表达式,该怎么解决

帮忙写个正则表达式,该怎么解决

WBOY
Release: 2016-06-13 11:28:51
Original
839 people have browsed it

帮忙写个正则表达式

		<dd class="clear"><br />		   												<a  target="_blank" title="爱丽丝cos" href="/cp/sK7A9su_Y29z.html">爱丽丝cos</a><br />									<a  target="_blank" title="爱丽丝连衣裙" href="/cp/sK7A9su_wazSwsi5.html">爱丽丝连衣裙</a><br />									<a  target="_blank" title="爱丽丝梦游仙境" href="/cp/sK7A9su_w87Tzs_JvrM.html">爱丽丝梦游仙境</a><br />									<a  target="_blank" title="爱丽丝疯狂回归" href="/cp/sK7A9su_t-i_8bvYuek.html">爱丽丝疯狂回归</a><br />									<a  target="_blank" title="爱丽丝花盆" href="/cp/sK7A9su_u6jF6A.html">爱丽丝花盆</a><br />									<a  target="_blank" title="爱丽丝手办" href="/cp/sK7A9su_ytaw7A.html">爱丽丝手办</a><br />									<a  target="_blank" title="alice" href="/cp/YWxpY2U.html">alice</a><br />									<a  target="_blank" title="女仆" href="/cp/xa7GzQ.html">女仆</a><br />									<a  target="_blank" title="爱丽丝学园" href="/cp/sK7A9su_0afUsA.html">爱丽丝学园</a><br />									<a  target="_blank" title="爱丽丝菲尔" href="/cp/sK7A9su_t8a2-w.html">爱丽丝菲尔</a><br />									<a  target="_blank" title="爱丽丝手包" href="/cp/sK7A9su_ytaw_A.html">爱丽丝手包</a><br />									<a  target="_blank" title="爱丽丝复古" href="/cp/sK7A9su_uLS5xQ.html">爱丽丝复古</a><br />								</dd>
Copy after login

我现在要取这个页面的
之间这段内容里的title的值和href的值,因为这个页面其他地方也有这种格式,所以现在直接用
$contents_key = '~<a  target="_blank" title="(.*?)" href="(.*?)">~';<br />preg_match_all($contents_key,$html,$contentskey);
Copy after login
这样会把dd标签外的相同格式的也包含进来,问下这个正则应该怎么写?

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