wp_spaces_regexp

The timeline below displays how wordpress function wp_spaces_regexp has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 5.5

/**
 * 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)) {
        /**
         * Filters the regexp for common whitespace characters.
         *
         * This string is substituted for the \s sequence as needed in regular
         * expressions. For websites not written in English, different characters
         * may represent whitespace. For websites not encoded in UTF-8, the 0xC2 0xA0
         * sequence may not be in use.
         *
         * @since 4.0.0
         *
         * @param string $spaces Regexp pattern for matching common whitespace characters.
         */
        $spaces = apply_filters('wp_spaces_regexp', '[\r\n\t ]|\xC2\xA0| ');
    }
    return $spaces;
}

WordPress Version: 5.4

/**
 * 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
 *
 * @staticvar string $spaces
 *
 * @return string The spaces regexp.
 */
function wp_spaces_regexp()
{
    static $spaces = '';
    if (empty($spaces)) {
        /**
         * Filters the regexp for common whitespace characters.
         *
         * This string is substituted for the \s sequence as needed in regular
         * expressions. For websites not written in English, different characters
         * may represent whitespace. For websites not encoded in UTF-8, the 0xC2 0xA0
         * sequence may not be in use.
         *
         * @since 4.0.0
         *
         * @param string $spaces Regexp pattern for matching common whitespace characters.
         */
        $spaces = apply_filters('wp_spaces_regexp', '[\r\n\t ]|\xC2\xA0| ');
    }
    return $spaces;
}

WordPress Version: 4.6

/**
 * 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
 *
 * @staticvar string $spaces
 *
 * @return string The spaces regexp.
 */
function wp_spaces_regexp()
{
    static $spaces = '';
    if (empty($spaces)) {
        /**
         * Filters the regexp for common whitespace characters.
         *
         * This string is substituted for the \s sequence as needed in regular
         * expressions. For websites not written in English, different characters
         * may represent whitespace. For websites not encoded in UTF-8, the 0xC2 0xA0
         * sequence may not be in use.
         *
         * @since 4.0.0
         *
         * @param string $spaces Regexp pattern for matching common whitespace characters.
         */
        $spaces = apply_filters('wp_spaces_regexp', '[\r\n\t ]|\xC2\xA0| ');
    }
    return $spaces;
}

WordPress Version: 4.3

/**
 * 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
 *
 * @staticvar string $spaces
 *
 * @return string The spaces regexp.
 */
function wp_spaces_regexp()
{
    static $spaces = '';
    if (empty($spaces)) {
        /**
         * Filter the regexp for common whitespace characters.
         *
         * This string is substituted for the \s sequence as needed in regular
         * expressions. For websites not written in English, different characters
         * may represent whitespace. For websites not encoded in UTF-8, the 0xC2 0xA0
         * sequence may not be in use.
         *
         * @since 4.0.0
         *
         * @param string $spaces Regexp pattern for matching common whitespace characters.
         */
        $spaces = apply_filters('wp_spaces_regexp', '[\r\n\t ]|\xC2\xA0| ');
    }
    return $spaces;
}

WordPress Version: 4.0

/**
 * 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)) {
        /**
         * Filter the regexp for common whitespace characters.
         *
         * This string is substituted for the \s sequence as needed in regular
         * expressions. For websites not written in English, different characters
         * may represent whitespace. For websites not encoded in UTF-8, the 0xC2 0xA0
         * sequence may not be in use.
         *
         * @since 4.0.0
         *
         * @param string $spaces Regexp pattern for matching common whitespace characters.
         */
        $spaces = apply_filters('wp_spaces_regexp', '[\r\n\t ]|\xC2\xA0| ');
    }
    return $spaces;
}