正则写法:/http:\/\/((?!http:\/\/).)+?(\.jpg|\.png)/
<?php
$a = 'http://www.baidu.com/product-abch<>div<.\]["http://image.baidu.com/image/201611/21/1479720785282743.jpg"';
preg_match_all('/http:\/\/((?!http:\/\/).)+?(\.jpg|\.png)/',$a,$imgUrls);
var_dump($imgUrls);
错误写法:
/http:\/\/.*?\.(jpg|jpeg|png)/
<?php
$a = 'http://www.baidu.com/product-abch<>div<.\]["http://image.baidu.com/image/201611/21/1479720785282743.jpg"';
preg_match_all('/http:\/\/.*?\.(jpg|jpeg|png)/',$a,$imgUrls);
var_dump($imgUrls);