Q:

Replace HTML entities with regular expression

I would like a regular expression in PHP to find all HTML entities such as "&lt;br /&gt; &lt;br /&gt; ..etc. " in order to remove them from a long string.

A:

This one removes alpha, decimal and hex HTML entities:
$text = preg_replace('/&(?:[a-z\d]+|#\d+|#x[a-f\d]+);/i', '', $text);

