// Filter 英文标点符号$word = preg_replace("/[[:punct:]]/i"," ",$word);
// Filter 中文标点符号mb_regex_encoding('utf-8');
$char = "。、!?:;﹑•"…‘’“”〝〞∕¦‖— 〈〉﹞﹝「」‹›〖〗】【»«』『〕〔》《﹐¸﹕︰﹔!¡?¿﹖﹌﹏﹋'´ˊˋ―﹫︳︴¯_ ̄﹢﹦﹤‐˜﹟﹩﹠﹪﹡﹨﹍﹉﹎﹊ˇ︵︶︷︸︹︿﹀︺︽︾ˉ﹁﹂﹃﹄︻︼()";
$word = mb_ereg_replace("[".$char."]"," ",$word,"UTF-8");
// Filter 连续空格$word = preg_replace("/\s+/"," ",$word);
mb_ereg_replace用于中文字符替换,正则的时候不需要加/ /。
参考链接:https://my.oschina.net/u/1470240/blog/1935959
http://blog.coinidea.com/web%E5%BC%80%E5%8F%91/php-1196.html