I think it would be better if used DOMDocument object:
$text = 'ala bala
';
$htmlDom = new DOMDocument;
$htmlDom->loadHTML($text);
$imageTags = $htmlDom->getElementsByTagName('img');
$extractedImages = array();
foreach($imageTags as $imageTag){
$extractedImages[] = $imageTag->getAttribute('src');
}
echo ''; var_dump($extractedImages); exit;