wp_spaces_regexp()
Проверено на WordPress 6.9, обновлено Источник: WordPress Developer Resources.
Сигнатура
wp_spaces_regexp(): string
Описание
По умолчанию к пробелам относятся переводы строк, табуляции, entity-последовательности nbsp и UTF-8 nbsp.
Это предназначено для замены последовательности «s» в PCRE. В тикете #22692 выяснилось, что эта последовательность ненадёжна из-за случайного включения байта A0.
Оригинал (английский)
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.
Возвращаемое значение
string
Исходный код
wp-includes/formatting.php:5843
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 xC2 xA0
* 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;
}
История изменений
| Версия | Описание |
|---|---|
| 4.0.0 | Introduced. |

