public function censorHtml($html, $censorAttributes = false)
	{
		$attributesExpr = '';
		if ($censorAttributes)
		{
			$attributesExpr = '|[^<">]*+(?="(?> [-\\w]+="[^"]*+")*+\\/?>)';
		}

		// Modify the original regexp so that it only matches text nodes and optionally attribute
		// values
		$delim  = $this->regexpHtml[0];
		$pos    = strrpos($this->regexpHtml, $delim);
		$regexp = $delim
		        . '(?<!&|&#)'
		        . substr($this->regexpHtml, 1, $pos - 1)
		        . '(?=[^<>]*+(?=<|$)' . $attributesExpr . ')'
		        . substr($this->regexpHtml, $pos);

		return preg_replace_callback(
			$regexp,
			function ($m)
			{
				return htmlspecialchars($this->getReplacement(html_entity_decode($m[0], ENT_QUOTES, 'UTF-8')), ENT_QUOTES);
			},
			$html
		);
	}