//I use preg_replace_callback which calls a user defined function ever time it finds a match. In that function I check the $firstTime global variable. If its set it won't blank out the img. Afterward I search and remove any empty tags. get_content(); $firstTime = true; $pattern = '/]+?[>]/is'; $string = preg_replace_callback($pattern, 'imgOff', $string); // remove empty tags $pattern = '/]*?[>]<\/a>/si'; $replacement = ''; $string = preg_replace($pattern, $replacement, $string); function imgOff($matches) // remove all but first img tag { global $firstTime; if ($firstTime) { $firstTime = 0; return $matches[0]; // skip first img tag } return ''; } ?>