Index: wp-includes/shortcodes.php
===================================================================
--- wp-includes/shortcodes.php	(revision 13387)
+++ wp-includes/shortcodes.php	(working copy)
@@ -139,16 +139,18 @@ function remove_all_shortcodes() {
  * @uses get_shortcode_regex() Gets the search pattern for searching shortcodes.
  *
  * @param string $content Content to search for shortcodes
+ * @param int $limit Maximum number of shortcode replacements, default is no limit
  * @return string Content with shortcodes filtered out.
  */
-function do_shortcode($content) {
+function do_shortcode($content, $limit = -1) {
 	global $shortcode_tags;
 
 	if (empty($shortcode_tags) || !is_array($shortcode_tags))
 		return $content;
 
 	$pattern = get_shortcode_regex();
-	return preg_replace_callback('/'.$pattern.'/s', 'do_shortcode_tag', $content);
+	$limit = (int)$limit;
+	return preg_replace_callback('/'.$pattern.'/s', 'do_shortcode_tag', $content, $limit);
 }
 
 /**
