如何在preg_match中允许阿拉伯字符?
if(!preg_match("/^[a-zA-Z0-9]+$/", "لحمدلله")) {
echo "Firstname can only use letters, numbers and arabic characters.";
}
答案 0 :(得分:3)
你可以用这个:
if(!preg_match("/^[\p{Arabic}a-zA-Z0-9]+$/u", "لحمدلله")) {
echo "Firstname can only use letters, numbers and arabic characters.";
}