时间:2021-07-01 10:21:17 帮助过:14人阅读
$str1 = 'http://www.uploadfr.com/images/2014/03/20/204417dydmmeowem3mlnl0.jpg.thumb0608f2.jpg';
$str2 = 'http://www.uploadfr.com/images/2014/03/20/204417dydmmeowem3mlnl0.jpg';
$pattern = '/^http:\/\/www\.uploadfr\.com\/images\/(\d{4})\/(\d{2})\/(\d{2})\/([a-z0-9]+)\.(jpg
------解决方案--------------------
png
------解决方案--------------------
gif
------解决方案--------------------
jpeg)(\.thumb([a-z0-9]{6})\.\\5)?$/';
preg_match($pattern, $str1, $match1);
preg_match($pattern, $str2, $match2);
print_r($match1);
print_r($match2);
$content=<<字字字字字字字字字字字字字字字字字字字字字字字字字字字字字字字字字字字字字字字字字字字字字字字字http://www.uploadfr.com/images/2014/03/20/204417dydmmeowem3mlnl0.jpg.thumb0608f2.jpg字字字字字字字字字字字字字字字字http://www.uploadfr.com/images/2014/03/20/204417dydmmeowem3mlnl0.jpg字字字字字字字字字字字字字字字字
TXT;
preg_match_all('/http:\/\/www.uploadfr.com\/images\/\d{4}\/\d{2}\/\d{2}\/\d{6}.*?jpg(\.thumb[a-z0-9]{6}\.jpg)?/si', $content, $matches);
print_r($matches[0]);