+ preg_match_all( '#(<pre[^>]*>.+?</pre>)#i', $tokenized, $matches, PREG_SET_ORDER );
+ foreach ( $matches as $i => $match ) {
+ $tag_html = str_replace( $replace, $search, $match[0] );
+ $tag_token = $token . $i;
+
+ $found[ $tag_token ] = $tag_html;
+ $html = str_replace( $tag_html, $tag_token, $html, $count );
+ }
+
+ $replaced = str_replace( $replace, $search, $html );
+ $stripped = str_replace( array( "\r\n", "\n" ), '', $replaced );
+ $pre = array_values( $found );
+ $tokens = array_keys( $found );
+
+ return str_replace( $tokens, $pre, $stripped );