when I send form and check for the arabic and english and numeric chars the code below not working :
<?
$username = $_POST["alalala"];
if ($username){
if (!preg_match("/^[a-zA-Z0-9ا-ي ]+$/i", $username)){
echo "error";
}else{
echo "ok";
}
}
?>
<form method="post">
<input type="text" name="alalala">
the regex can’t find arabic in $_post[alalala]
EDIT
not working :s, the problem not in p{Arabic}
it’s in finding the arabic chars only when form submit
EDIT2 : when i change the line
$username = $_POST["alalala"];
to
$username = "any thing نستيتيلا";
the regex find the arabic chars
try https://stackoverflow.com/a/3631408/731179
PHP supports PCRE
http://fi.php.net/manual/en/function.preg-match.php#105324
http://fi.php.net/manual/en/regexp.reference.unicode.php