How do I exactly match multiple instances of img tags? I read up a few tutorials on preg_match yet never really quite understand.
I have this as my base:
<img src="http://example.com/1.png" alt="Example" />
<img class="Class" src="http://example.com/2.jpg" alt="Example 2" />
And I did up a small like regex:
<img (src="|class="Class" src=")http://.+\.(?:jpe?g|png)" alt="
After this, I'm stuck. How do I continue to match all till the end of the both strings?
I found out about the array part on PHP website itself:
preg_match('@^(?:http://)?([^/]+)@i',
"http://www.php.net/index.html", $matches);
$host = $matches[1];
Using my code, how do I get the image URL, and the alt tag?
Thanks!