diff --git a/src/wp-includes/formatting.php b/src/wp-includes/formatting.php index a07a020629..56a9c1edd0 100644 --- a/src/wp-includes/formatting.php +++ b/src/wp-includes/formatting.php @@ -3844,3 +3844,24 @@ function get_url_in_content( $content ) { return false; } + +/** + * Returns the regexp for common whitespace characters. + * + * By default, spaces include new lines, tabs, nbsp entities, and the UTF-8 nbsp. + * This is designed to replace the PCRE \s sequence. In ticket #22692, that + * sequence was found to be unreliable due to random inclusion of the A0 byte. + * + * @since 4.0.0 + * + * @return string The spaces regexp. + */ +function wp_spaces_regexp() { + static $spaces; + + if ( empty( $spaces ) ) { + $spaces = apply_filters( 'wp_spaces_regexp', '[\r\n\t ]|\xC2\xA0| ' ); + } + + return $spaces; +} \ No newline at end of file