drupal_valid_http_host($host)
drupal/includes/bootstrap.inc, line 536
Validate that a hostname (for example $_SERVER['HTTP_HOST']) is safe.
TRUE if only containing valid characters, or FALSE otherwise.
function drupal_valid_http_host($host) {
return preg_match('/^\[?(?:[a-zA-Z0-9-:\]_]+\.?)+$/', $host);
}