'; // FOR DEBUGING //echo '
'; print_r($img_posts);    echo '
'; // FOR DEBUGING // Loop through each post and extract date and entry text: foreach($img_posts as $post){ $date = preg_filter('/^(?[^\t]+)\t(?.+)/', '\1', $post) ; $entry = preg_filter('/^(?[^\t]+)\t(?.+)/', '\2', $post) ; $text_only = preg_filter('/!\[(.*?)\]\((.*?)\)/', '\1', $entry); // this gives the post without the markdown img links (not sure why, but it works) $text_only = trim($text_only); $text_only = strip_tags($text_only); preg_match_all('/!\[(?.*?)\]\((?.*?)\)/', $entry, $img_array); //echo '
'; print_r($img_array);    echo '
'; // FOR DEBUGING foreach($img_array[url] as $img => $val) { $url = $img_array[url][$img]; //$alt = $img_array[alt][$img]; //echo ''.$text_only.''; echo ''.$text_only.''; } } ?>