Most PHP docs show regexps wrapped in slashes like:
preg_replace( '/\s+/', ' ', $str );
I was looking in the source of WP’s formatting.php and saw some regexps wrapped in pipes instead of slashes. How does the behavior of wrapping in pipes differ from wrapping in slashes? Is there any functional difference? Some examples in that file are:
preg_replace( '|\s+|', ' ', $str ); # consolidate whitespace
preg_replace( '|%([a-fA-F0-9][a-fA-F0-9])|', '', $str ); # remove octets
Non-slash delimiters, like the pipe character, make it easier to match for slashes, because you don’t have to escape them.