Possible Duplicate:
How to extract img src, title and alt from html using php?
I am trying to parse a webpage and get the full images. E.g
<html>
<body>
<a href='1.jpg'><img src='tn1.jpg /></a>
<a href='2.jpg'><img src='tn2.jpg /></a>
<a href='3.jpg'><img src='tn3.jpg /></a>
<a href='4.jpg'><img src='tn4.jpg /></a>
</body>
</html>
So I am trying to capture them to get the full thumbnails which are:
1.jpg
2.jpg
3.jpg
4.jpg
My PHP Regex code is:
$text = file_get_contents($website); //Get webpage
preg_match_all("~$[0-9](.*?)\.jpg~i", $text, $matches);
But when I run it, the $matches array is empty yet the paths are there in the webiste. What might be wrong with my Regex?
INFO: All images follow a pattern and are all a number followed by .jpg