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.
5843functionwp_spaces_regexp(){5844static$spaces='';58455846if(empty($spaces)){5847/**5848 * Filters the regexp for common whitespace characters.5849 *5850 * This string is substituted for the \s sequence as needed in regular5851 * expressions. For websites not written in English, different characters5852 * may represent whitespace. For websites not encoded in UTF-8, the 0xC2 0xA05853 * sequence may not be in use.5854 *5855 * @since 4.0.05856 *5857 * @param string $spaces Regexp pattern for matching common whitespace characters.5858 */5859$spaces=apply_filters('wp_spaces_regexp','[\r\n\t ]|\xC2\xA0| ');5860}58615862return$spaces;5863}
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.0.4 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.