note 105266 added to function.preg-match
| From: | itworkarounds at gmail dot com | Date: | Fri, 05 Aug 2011 20:06:07 +0000 |
| Subject: | note 105266 added to function.preg-match | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-182270@lists.php.net to get a copy of this message | ||
You can use the following pattern to match Cyrillic characters
$str="ABC abc 1234 ÐÐРабв";
$pattern = "/^[a-zA-Z\p{Cyrillic}0-9\s\-]+$/u";
$result = (bool) preg_match($pattern, $str);
if($result)
echo "$str is composed of Cyrillic and alphanumeric characters\n";
see the following post for more examples:
http://itworkarounds.blogspot.com/2011/08/validating-cyrillic-utf8-alphanumeric.html
----
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/105266
Del: integrated -- https://master.php.net/note/delete/105266/integrated
Del: useless -- https://master.php.net/note/delete/105266/useless
Del: bad code -- https://master.php.net/note/delete/105266/bad+code
Del: spam -- https://master.php.net/note/delete/105266/spam
Del: non-english -- https://master.php.net/note/delete/105266/non-english
Del: in docs -- https://master.php.net/note/delete/105266/in+docs
Del: other reasons-- https://master.php.net/note/delete/105266
Reject -- https://master.php.net/note/reject/105266
Search -- https://master.php.net/manage/user-notes.php