PHP preg_replace中的\ w仅覆盖UTF-8字符的第二个字节 [英] \w in PHP preg_replace covers only second byte of UTF-8 chars
本文介绍了PHP preg_replace中的\ w仅覆盖UTF-8字符的第二个字节的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我们有以下代码:
$value = preg_replace("/[^\w]/", '', $value);
其中$value
在utf-8中.在此转换之后,将剥离多字节字符的第一个字节.如何使\ w完全覆盖UTF-8字符?
where $value
is in utf-8. After this transformation first byte of multibyte characters is stripped. How to make \w cover UTF-8 chars completely?
对不起,我对PHP不太满意
Sorry, i am not very well in PHP
推荐答案
try this function instead...http://php.net/manual/en/function.mb-ereg-replace.php
这篇关于PHP preg_replace中的\ w仅覆盖UTF-8字符的第二个字节的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文