Index: src/wp-includes/formatting.php
===================================================================
--- src/wp-includes/formatting.php	(revision 29713)
+++ src/wp-includes/formatting.php	(working copy)
@@ -28,7 +28,7 @@
  * @return string The string replaced with html entities
  */
 function wptexturize($text, $reset = false) {
-	global $wp_cockneyreplace;
+	global $wp_cockneyreplace, $shortcode_tags;
 	static $static_characters, $static_replacements, $dynamic_characters, $dynamic_replacements,
 		$default_no_texturize_tags, $default_no_texturize_shortcodes, $run_texturize = true;
 
@@ -205,6 +205,10 @@
 
 	// Look for shortcodes and HTML elements.
 
+	$tagnames = array_keys( $shortcode_tags );
+	$tagregexp = join( '|', array_map( 'preg_quote', $tagnames ) );
+	$tagregexp = "(?:$tagregexp)(?![\\w-])"; // Excerpt of get_shortcode_regex().
+	
 	$regex =  '/('			// Capture the entire match.
 		.	'<'		// Find start of element.
 		.	'(?(?=!--)'	// Is this a comment?
@@ -215,6 +219,7 @@
 		. '|'
 		.	'\['		// Find start of shortcode.
 		.	'\[?'		// Shortcodes may begin with [[
+		.	$tagregexp	// Only match registered shortcodes, because performance.
 		.	'(?:'
 		.		'[^\[\]<>]'	// Shortcodes do not contain other shortcodes.
 		.	'|'
Index: tests/phpunit/tests/formatting/WPTexturize.php
===================================================================
--- tests/phpunit/tests/formatting/WPTexturize.php	(revision 29713)
+++ tests/phpunit/tests/formatting/WPTexturize.php	(working copy)
@@ -11,7 +11,6 @@
 
 	function test_disable() {
 		$this->assertEquals('<pre>---</pre>', wptexturize('<pre>---</pre>'));
-		$this->assertEquals('[a]a&#8211;b[code]---[/code]a&#8211;b[/a]', wptexturize('[a]a--b[code]---[/code]a--b[/a]'));
 		$this->assertEquals('<pre><code></code>--</pre>', wptexturize('<pre><code></code>--</pre>'));
 
 		$this->assertEquals( '<code>---</code>',     wptexturize( '<code>---</code>'     ) );
@@ -1213,26 +1212,6 @@
 				'[/...]',
 			),
 			array(
-				'[...]...[/...]', // These are potentially usable shortcodes.
-				'[...]&#8230;[/...]',
-			),
-			array(
-				'[[...]]...[[/...]]', // Shortcode parsing will ignore the inner ]...[ part and treat this as a single escaped shortcode.
-				'[[...]]&#8230;[[/...]]',
-			),
-			array(
-				'[[[...]]]...[[[/...]]]', // Again, shortcode parsing matches, but only the [[...] and [/...]] parts.
-				'[[[...]]]&#8230;[[[/...]]]',
-			),
-			array(
-				'[[code]...[/code]...', // These are potentially usable shortcodes.  Unfortunately, the meaning of [[code] is ambiguous unless we run the entire shortcode regexp.
-				'[[code]&#8230;[/code]&#8230;',
-			),
-			array(
-				'[code]...[/code]]...', // These are potentially usable shortcodes.  Unfortunately, the meaning of [/code]] is ambiguous unless we run the entire shortcode regexp.
-				'[code]...[/code]]...', // This test would not pass in 3.9 because the extra brace was always ignored by texturize.
-			),
-			array(
 				'[gal>ery ...]',
 				'[gal>ery &#8230;]',
 			),
@@ -1344,10 +1323,6 @@
 				'[ but also catches the <b>styled "[quote]" here</b> ]',
 				'[ but also catches the <b>styled &#8220;[quote]&#8221; here</b> ]',
 			),
-			array(
-				'[Let\'s get crazy<input>[plugin code="<a href=\'?a[]=100\'>hello</a>"]</input>world]',
-				'[Let&#8217;s get crazy<input>[plugin code="<a href=\'?a[]=100\'>hello</a>"]</input>world]',
-			),
 		);
 	}
 
@@ -1697,7 +1672,50 @@
 				'<code>hello</span>---</span>',
 				'<code>hello</span>---</span>',
 			),
+		);
+	}
+
+	/**
+	 * These tests are obsolete and will fail.
+	 *
+	 * @ticket 29557
+	 * @dataProvider data_unregistered_shortcodes
+	 */
+	function test_unregistered_shortcodes( $input, $output ) {
+		return $this->assertEquals( $output, wptexturize( $input ) );
+	}
+
+	function data_unregistered_shortcodes() {
+		return array(
 			array(
+				'[a]a--b[code]---[/code]a--b[/a]',
+				'[a]a&#8211;b[code]---[/code]a&#8211;b[/a]',
+			),
+			array(
+				'[...]...[/...]', // These are potentially usable shortcodes.
+				'[...]&#8230;[/...]',
+			),
+			array(
+				'[[...]]...[[/...]]', // Shortcode parsing will ignore the inner ]...[ part and treat this as a single escaped shortcode.
+				'[[...]]&#8230;[[/...]]',
+			),
+			array(
+				'[[[...]]]...[[[/...]]]', // Again, shortcode parsing matches, but only the [[...] and [/...]] parts.
+				'[[[...]]]&#8230;[[[/...]]]',
+			),
+			array(
+				'[[code]...[/code]...', // These are potentially usable shortcodes.  Unfortunately, the meaning of [[code] is ambiguous unless we run the entire shortcode regexp.
+				'[[code]&#8230;[/code]&#8230;',
+			),
+			array(
+				'[code]...[/code]]...', // These are potentially usable shortcodes.  Unfortunately, the meaning of [/code]] is ambiguous unless we run the entire shortcode regexp.
+				'[code]...[/code]]...', // This test would not pass in 3.9 because the extra brace was always ignored by texturize.
+			),
+			array(
+				'[Let\'s get crazy<input>[plugin code="<a href=\'?a[]=100\'>hello</a>"]</input>world]',
+				'[Let&#8217;s get crazy<input>[plugin code="<a href=\'?a[]=100\'>hello</a>"]</input>world]',
+			),
+			array(
 				'<span>hello[/code]---</span>',
 				'<span>hello[/code]&#8212;</span>',
 			),
