note 105324 modified in function.preg-match by danbrown
| From: | danbrown@php.net | Date: | Tue, 09 Aug 2011 16:17:10 +0000 |
| Subject: | note 105324 modified in function.preg-match by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-182373@lists.php.net to get a copy of this message | ||
You can use the following code to detect non-latin (Cyrilic, Arabic, Greek...) characters:
<?php
preg_match("/^[a-zA-Z\p{Cyrillic}0-9\s\-]+$/u", "ABC abc 1234 ÐÐÐ
абв");
?>
--was--
You can use the following code to detect non-latin (Cyrilic, Arabic, Greek...) characters:
<?php
preg_match("/^[a-zA-Z\p{Cyrillic}0-9\s\-]+$/u", "ABC abc 1234 ÐÐÐ
абв");
?>
See the explanation here:
http://itworkarounds.blogspot.com/2011/08/validating-cyrillic-utf8-alphanumeric.html
The full list of alphabets can be found here:
http://www.php.net/manual/en/regexp.reference.unicode.php#102756
http://php.net/manual/en/function.preg-match.php