Re: RegEx to check for non-Latin characters

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 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 and Numerical characters in a
> string.
> 2) Regex to check whether the string only consists of certain characters.

In a PCRE regex, [\x80-\xFF] will find all extended ASCII chars. Or,
if you wanted all ASCII chars, you could use: [\x00-\xFF] That would
catch space and punctuation as well though. Or you could amend it to
suit. It's in hexadecimal (ie FF == 255)

-- 
Richard Heyes

HTML5 Graphing for FF, Chrome, Opera and Safari:
http://www.rgraph.org (Updated November 1st)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux