我怎样才能在PHP中使用正则表达式匹配阿拉伯语字母

时间:2010-11-10 14:55:12

标签: php regex arabic

如何在php中使用正则表达式匹配阿拉伯字母

我的代码

$name = $_GET("name");

if (arabic letters only and spaces) // using regexp

1 个答案:

答案 0 :(得分:10)

我认为你的答案在这里: Check the language of string based on glyphs in PHP

if(preg_match("/\p{Arabic}/u", $name])) {
echo 'valid';
}