1. 程式人生 > >php將標點符號替換為空格

php將標點符號替換為空格

php用正則匹配將符號替換為空格

<?php 
$character = "[email protected]#$%^&*中'文中'文中'文().,<>|[]'\":;}{-_+=?/abcdefgh中'文ijklmnopqrstuvwx中'文yzABCDEFGHI中文JKLMNOPQRSTUVWXYZ~`中'文文文文文";
$reg = "/[[:punct:]]/i";
$character = preg_replace($reg, '', $character);
print_r($character);
die;
?>