I have 2 problems with regular expressions:
1) I want to get the image's filenames from a website:
e.g. src="http://bytes.com/images/world.jpg", src=images/world.jpg and src='images/world.jpg' should result in "world"
2) I want to get the alt descriptions from images in a website
But both my expressions don't work because I don't really get it ;-).
1) I want to get the image's filenames from a website:
e.g. src="http://bytes.com/images/world.jpg", src=images/world.jpg and src='images/world.jpg' should result in "world"
Code:
$imgfilenames=preg_match_all('/^[0-9A-Za-z_ ](.jpg|.gif|.JPG|.GIF|.png|.PNG)$/i', $html, $matches);
Code:
$alttags=preg_match_all('/<img[^>]*alt="([^"]*)"/i', $html, $matches);
Comment