Returns the regexp for common whitespace characters.
Description
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.
Return
string
The spaces regexp.
Hooks fired · 1
One hook fires while wp_spaces_regexp() runs, in this order:
smilies_init()Converts smiley code to the icon graphic file equivalent.
wptexturize()Replaces common plain text characters with formatted entities.
wptexturize_primes()Implements a logic tree to determine whether or not "7'." represents seven feet, then converts the special char into either a prime char or a closing quote char.
5934functionwp_spaces_regexp(){5935static$spaces='';59365937if(empty($spaces)){5938/**5939 * Filters the regexp for common whitespace characters.5940 *5941 * This string is substituted for the \s sequence as needed in regular5942 * expressions. For websites not written in English, different characters5943 * may represent whitespace. For websites not encoded in UTF-8, the 0xC2 0xA05944 * sequence may not be in use.5945 *5946 * @since 4.0.05947 *5948 * @param string $spaces Regexp pattern for matching common whitespace characters.5949 */5950$spaces=apply_filters('wp_spaces_regexp','[\r\n\t ]|\xC2\xA0| ');5951}59525953return$spaces;5954}
History
Introduced in 4.0.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
Parsed data
Generated from the wordpress-develop 7.1.0 tag, from src/wp-includes/formatting.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.