两个字符串之间的正则表达式匹配(第二场比赛的第一个实例)

时间:2016-10-28 18:38:06

标签: php regex

我试图匹配图片HTML中srcset属性的内容。

My Regex:

srcset="(.*)[^"]

字符串:

<img alt="Google" height="92" id="hplogo" src="https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png" srcset="https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png 1x, /images/branding/googlelogo/2x/googlelogo_color_272x92dp.png 2x" style="padding-top:109px" width="272" onload="window.lol&amp;&amp;lol()">

注意它是如何在srcset和&#34;之间匹配的,但它是最后一个&#34;。它需要匹配最接近的&#34;后。有谁知道什么是错的?

0 个答案:

没有答案