note 105324 added to function.preg-match
| From: | itworkarounds at gmail dot com | Date: | Tue, 09 Aug 2011 16:08:09 +0000 |
| Subject: | note 105324 added to function.preg-match | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-182371@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 ÐÐÐ
абв");
?>
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
----
Server IP: 69.147.83.197
Probable Submitter: 95.180.200.222
----
Manual Page -- http://www.php.net/manual/en/function.preg-match.php
Edit -- https://master.php.net/note/edit/105324
Del: integrated -- https://master.php.net/note/delete/105324/integrated
Del: useless -- https://master.php.net/note/delete/105324/useless
Del: bad code -- https://master.php.net/note/delete/105324/bad+code
Del: spam -- https://master.php.net/note/delete/105324/spam
Del: non-english -- https://master.php.net/note/delete/105324/non-english
Del: in docs -- https://master.php.net/note/delete/105324/in+docs
Del: other reasons-- https://master.php.net/note/delete/105324
Reject -- https://master.php.net/note/reject/105324
Search -- https://master.php.net/manage/user-notes.php