note 58409 added to reference.pcre.pattern.modifiers

From: Date: Thu, 03 Nov 2005 12:12:40 +0000
Subject: note 58409 added to reference.pcre.pattern.modifiers
Groups: php.notes 
Request: Send a blank email to php-notes+get-98020@lists.php.net to get a copy of this message
Spent a few days, trying to understand how to create a pattern for Unicode chars, using the hex codes. Finally made it, after reading several manuals, that weren't giving any practical PHP-valid examples. So here's one of them: For example we would like to search for Japanese-standard circled numbers 1-9 (Unicode codes are 0x2460-0x2468) in order to make it through the hex-codes the following call should be used: preg_match('/[\x{2460}-\x{2468}]/u', $str); Here $str is a haystack string \x{hex} - is an UTF-8 hex char-code and /u is used for identifying the class as a class of Unicode chars. Hope, it'll be useful. ---- Manual Page -- http://www.php.net/manual/en/reference.pcre.pattern.modifiers.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+58409 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+58409&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+58409&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+58409&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+58409&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+58409&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+58409&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+58409&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+58409&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#98020) next »