Reputation: 2514
i have checked many answers but i am still straggling to find a solution.
Case 1:
<div id="vsImage" itemprop="image" data-zoom-src="http://example.com/product/760x1013/V373872.jpg"/>
Case 2:
<a href="#"><img src="http://example.com/product/760x1013/V373872.jpg"></a>
I know i can easily extract all images from tag with PHP DOMDocument, but in this case 1 image source is not in tag.
Maybe the question is, can i somehow get all *.jpg strings from html?
Thanks in advance.
Upvotes: 0
Views: 709
Reputation: 3642
Try this:
$content = "your HTML content $here";
$matches = NULL;
$pattern = '/(?:http|https|ftp):\/\/\S+\.(?:jpg|jpeg)/';
preg_match_all ($pattern, $content, $matches);
Upvotes: 4
Reputation: 20737
Match all strings between http
and .jpg
that doesn't contain a "
.
/http[^\"]+\.jpg/g
Upvotes: 0