diff --git wp-includes/media.php wp-includes/media.php
index e3b9008..808dcaf 100644
--- wp-includes/media.php
+++ wp-includes/media.php
@@ -1261,7 +1261,11 @@ class WP_Embed {
 	 * @return string Potentially modified $content.
 	 */
 	function autoembed( $content ) {
-		return preg_replace_callback( '|^\s*(https?://[^\s"]+)\s*$|im', array(&$this, 'autoembed_callback'), $content );
+		return preg_replace_callback(
+			'|^\s*(?:<a href="[^"]+">)?(?P<url>https?://[^\s<"]+)(?:</a>)?\s*$|im',
+			array( &$this, 'autoembed_callback' ),
+			$content
+		);
 	}
 
 	/**
@@ -1275,7 +1279,7 @@ class WP_Embed {
 	function autoembed_callback( $match ) {
 		$oldval = $this->linkifunknown;
 		$this->linkifunknown = false;
-		$return = $this->shortcode( array(), $match[1] );
+		$return = $this->shortcode( array(), $match['url'] );
 		$this->linkifunknown = $oldval;
 
 		return "\n$return\n";
