Why is preg_match_all slower on a large string than in a loop of smaller strings with the ...

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

While using the following loop to extract images from the google search
engine I discovered that preg_match_all works much faster parsing small
strings in a loop than extracting all of the urls at once from a much
larger string.

This surprised me because I expected the preg_match_all to perform the
task much faster.  Why is this, and is there an easier way to resolve
this matter?

for ($i = 0; $i < $m; $i++, $start+=20){
$saURL = "http://images.google.com/images?q =" .  $searchString .
"&start=" . $start;
preg_match_all("/:(www\S+?\.(jpg|png|bmp|gif))/i", file_get_contents(
$saURL ), $matches);
$image = array_merge($image, $matches[1]);

Site Timeline