For a Form Validation process, I need a function to avoid Latin characters
to be provided as the first or last name. Since we expect our users to
enter their personal info in Persian.
Do you know any regular expression to provide this functionality?
1) Regex to check whether there are Latin
Hi Behzad,
I would try a different approach ...
EXAMPLE (UTF-8):
!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
html xmlns=http://www.w3.org/1999/xhtml;
head
meta http-equiv=Content-Type content=text/html; charset=utf-8 /
Thanks everyone. I guess I find the answer:
*// return true if the $str ONLY consists of Arabic characters and
space-character
public function isArabicString($str)
{
return preg_match('/^([\p{Arabic}]|\s)*$/u', $str);
}
*
PHP 5.1.x or higher is required.
@see:
Dear List,
For a Form Validation process, I need a function to avoid Latin characters
to be provided as the first or last name. Since we expect our users to
enter their personal info in Persian.
Do you know any regular expression to provide this functionality?
1) Regex to check whether there are
4 matches
Mail list logo