note 52868 deleted from reference.pcre.pattern.syntax by colder

From: Date: Mon, 18 Jun 2007 17:59:20 +0000
Subject: note 52868 deleted from reference.pcre.pattern.syntax by colder
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-127559@lists.php.net to get a copy of this message
Note Submitter: xlex0x835 at rambler dot ru ---- Attention (it may saves you lot's of time): in this doc there is no words about Unicode operations in pcre_* functions, while it is very important. Just read missing part (from http://www.pcre.org/pcre.txt): ================== In UTF-8 mode, characters with values greater than 128 never match \d, \s, or \w, and always match \D, \S, and \W. This is true even when Uni- code character property support is available. ================== What to do: ================== Unicode character properties When PCRE is built with Unicode character property support, three addi- tional escape sequences to match generic character types are available when UTF-8 mode is selected. They are: \p{xx} a character with the xx property \P{xx} a character without the xx property \X an extended Unicode sequence The property names represented by xx above are limited to the Unicode general category properties. Each character has exactly one such prop- erty, specified by a two-letter abbreviation. For compatibility with Perl, negation can be specified by including a circumflex between the opening brace and the property name. For example, \p{^Lu} is the same as \P{Lu}. If only one letter is specified with \p or \P, it includes all the properties that start with that letter. In this case, in the absence of negation, the curly brackets in the escape sequence are optional; these two examples have the same effect: \p{L} \pL The following property codes are supported: C Other Cc Control Cf Format Cn Unassigned Co Private use Cs Surrogate L Letter Ll Lower case letter Lm Modifier letter Lo Other letter Lt Title case letter Lu Upper case letter M Mark Mc Spacing mark Me Enclosing mark Mn Non-spacing mark N Number Nd Decimal number Nl Letter number No Other number P Punctuation Pc Connector punctuation Pd Dash punctuation Pe Close punctuation Pf Final punctuation Pi Initial punctuation Po Other punctuation Ps Open punctuation S Symbol Sc Currency symbol Sk Modifier symbol Sm Mathematical symbol So Other symbol Z Separator Zl Line separator Zp Paragraph separator Zs Space separator Extended properties such as "Greek" or "InMusicalSymbols" are not sup- ported by PCRE. Specifying caseless matching does not affect these escape sequences. For example, \p{Lu} always matches only upper case letters. The \X escape matches any number of Unicode characters that form an extended Unicode sequence. \X is equivalent to (?>\PM\pM*) That is, it matches a character without the "mark" property, followed by zero or more characters with the "mark" property, and treats the sequence as an atomic group (see below). Characters with the "mark" property are typically accents that affect the preceding character. Matching characters by Unicode property is not fast, because PCRE has to search a structure that contains data for over fifteen thousand characters. That is why the traditional escape sequences such as \d and \w do not use Unicode properties in PCRE. ==================

« previous php.notes (#127559) next »