Jen*_*ell 0 php regex preg-replace
我想把这些字母和数字保存在一个字符串中
我不想要这个
码
$content = preg_replace("???", "", $string);
Run Code Online (Sandbox Code Playgroud)
您可以使用Jonny 5方法来编写字符类中所需的所有字符.您可以使用\p{Latin}包含所有拉丁字母的预定义类(以及重点字母):
$content = preg_replace('~[^\p{Latin}0-9]+~u', '', $string);
Run Code Online (Sandbox Code Playgroud)
如果你想要"世界"的所有字母或数字:
$content = preg_replace('~\P{Xan}+~u', '', $string);
Run Code Online (Sandbox Code Playgroud)