| ')
{
mb_regex_encoding('UTF-8');
//replace MS special characters first
$search = array('/‘/u', '/’/u', '/“/u', '/”/u', '/—/u');
$replace = array('\'', '\'', '"', '"', '-');
$text = preg_replace($search, $replace, $text);
if (mb_stripos($text, '/*') !== false) {
$text = mb_eregi_replace('#/\*.*?\*/#s', '', $text, 'm');
}
$text = preg_replace(array('/<([0-9]+)/'), array('< $1'), $text);
$text = strip_tags($text, $allowed_tags);
$text = preg_replace(array('/^\s\s+/', '/\s\s+$/', '/\s\s+/u'), array('', '', ' '), $text);
$search = array('#<(strong|b)[^>]*>(.*?)(strong|b)>#isu', '#<(em|i)[^>]*>(.*?)(em|i)>#isu', '#]*>(.*?)#isu');
$replace = array('$2', '$2', '$1');
$text = preg_replace($search, $replace, $text);
$num_matches = preg_match_all("/\
|
|