$wd='但要保留正常的某些VaGaaí′ú V2.'; $wd = mb_convert_encoding($wd, 'UTF-8', 'GB2312');\\只能对UTF8字符进行过滤。 preg_match_all('/[\s\x{4e00}-\x{9fff}a-zA-Z0-9#\[\]\{\}\'\"=+\-\(\)*&%$@]+/iu', $wd, $matches); $wd = join('', $matches[0]); $wd = mb_convert_encoding($wd, "GB2312", "UTF-8");\\过滤后转换成GB2312 echo $wd
php正则匹配中文,英文字母,空格,去除特殊字符。
未经允许不得转载:程序开发爱好者 » php正则匹配中文,英文字母,空格,去除特殊字符。