January 31, 2014

PHP Regular Expressions to Extract Images from HTML Content

PHP Regular Expressions to Extract Images from HTML Content

//preg_match_all('/<img[^>]+>/i', $description, $img);
//preg_match_all('/src="([^"]*)"/', $description, $img);
preg_match_all('@<img.*src="([^"]*)"[^>/]*/?>@Ui', $description, $img);

Last updated: March 19, 2014