Re: adrian holovaty
You must also escape '#' character. Next thing is that there is more then one whitespace character (a space).. Also IMO the name preg_quote_white() won't tell what the new function does so we could rename it. And finally, we should also add $delimiter:
<?php
function preg_xquote($a, $delimiter = null) {
if ($delimiter) {
return preg_replace('/[\s#]/', '\\\0', preg_quote($a, substr("$delimiter", 0, 1)));
} else {
return preg_replace('/[\s#]/', '\\\0', preg_quote($a));
}
}
?>