返回常见空白字符的正则表达式。

原型

wp_spaces_regexp()

描述

默认情况下,空格包括新行,制表符,实体和UTF-8 nbsp。这旨在取代PCRE的序列。在票

返回值

(string)  空间regexp。

源文件

路径:wp-includes/formatting.php

<?php
...
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', '[rnt ]|xC2xA0|&nbsp;' );
	}
	return $spaces;
}
...
?>

其他

英文文档:https://developer.wordpress.org/reference/functions/wp_spaces_regexp/