Index: shortcodes.php
===================================================================
--- shortcodes.php	(revision 19670)
+++ shortcodes.php	(working copy)
@@ -179,10 +179,10 @@
 	// WARNING! Do not change this regex without changing do_shortcode_tag() and strip_shortcode_tag()
 	return
 		  '\\['                              // Opening bracket
-		. '(\\[?)'                           // 1: Optional second opening bracket for escaping shortcodes: [[tag]]
-		. "($tagregexp)"                     // 2: Shortcode name
+		. '(?P<escape-open>\\[?)'            // 1: Optional second opening bracket for escaping shortcodes: [[tag]]
+		. "(?P<name>$tagregexp)"             // 2: Shortcode name
 		. '\\b'                              // Word boundary
-		. '('                                // 3: Unroll the loop: Inside the opening shortcode tag
+		. '(?P<attributes>'                  // 3: Unroll the loop: Inside the opening shortcode tag
 		.     '[^\\]\\/]*'                   // Not a closing bracket or forward slash
 		.     '(?:'
 		.         '\\/(?!\\])'               // A forward slash not followed by a closing bracket
@@ -195,7 +195,7 @@
 		. '|'
 		.     '\\]'                          // Closing bracket
 		.     '(?:'
-		.         '('                        // 5: Unroll the loop: Optionally, anything between the opening and closing shortcode tags
+		.         '(?P<content>'             // 5: Unroll the loop: Optionally, anything between the opening and closing shortcode tags
 		.             '[^\\[]*+'             // Not an opening bracket
 		.             '(?:'
 		.                 '\\[(?!\\/\\2\\])' // An opening bracket not followed by the closing shortcode tag
@@ -205,7 +205,7 @@
 		.         '\\[\\/\\2\\]'             // Closing shortcode tag
 		.     ')?'
 		. ')'
-		. '(\\]?)';                          // 6: Optional second closing brocket for escaping shortcodes: [[tag]]
+		. '(?P<escape-close>\\]?)';          // 6: Optional second closing bracket for escaping shortcodes: [[tag]]
 }
 
 /**
@@ -223,19 +223,19 @@
 	global $shortcode_tags;
 
 	// allow [[foo]] syntax for escaping a tag
-	if ( $m[1] == '[' && $m[6] == ']' ) {
+	if ( $m['escape-open'] == '[' && $m['escape-close'] == ']' ) {
 		return substr($m[0], 1, -1);
 	}
 
-	$tag = $m[2];
-	$attr = shortcode_parse_atts( $m[3] );
+	$tag = $m['name'];
+	$attr = shortcode_parse_atts( $m['attributes'] );
 
-	if ( isset( $m[5] ) ) {
+	if ( isset( $m['content'] ) ) {
 		// enclosing tag - extra parameter
-		return $m[1] . call_user_func( $shortcode_tags[$tag], $attr, $m[5], $tag ) . $m[6];
+		return $m['escape-open'] . call_user_func( $shortcode_tags[$tag], $attr, $m['content'], $tag ) . $m['escape-close'];
 	} else {
 		// self-closing tag
-		return $m[1] . call_user_func( $shortcode_tags[$tag], $attr, NULL,  $tag ) . $m[6];
+		return $m['escape-open'] . call_user_func( $shortcode_tags[$tag], $attr, NULL,  $tag ) . $m['escape-close'];
 	}
 }
 
@@ -324,11 +324,11 @@
 
 function strip_shortcode_tag( $m ) {
 	// allow [[foo]] syntax for escaping a tag
-	if ( $m[1] == '[' && $m[6] == ']' ) {
+	if ( $m['escape-open'] == '[' && $m['escape-close'] == ']' ) {
 		return substr($m[0], 1, -1);
 	}
 
-	return $m[1] . $m[6];
+	return $m['escape-open'] . $m['escape-close'];
 }
 
 add_filter('the_content', 'do_shortcode', 11); // AFTER wpautop()
