I've got the (HTML) contents of the page in a string called $contents and I'd like to be able to take all the bits ending in .jpg" or .gif" and get the addresses for each of them.
For example, here is a small HTML page:
Code: Select all
<html>
<head>
<title>Bob</title>
</head>
<body>
<img src="images/bob.jpg">
<br><br>
<img src="images/hector.gif" alt="Hector Rocks">
</body>
</html>Code: Select all
1 => images/bob.jpg
2 => images/hector.gif