note 103348 added to reference.pcre.pattern.modifiers

From: Date: Fri, 08 Apr 2011 15:03:58 +0000
Subject: note 103348 added to reference.pcre.pattern.modifiers
Groups: php.notes 
Request: Send a blank email to php-notes+get-178634@lists.php.net to get a copy of this message
The description of the "u" flag is a bit misleading. It suggests that it is only required if the pattern contains UTF-8 characters, when in fact it is required if either the pattern or the subject contain UTF-8. Without it, I was having problems with preg_match_all returning invalid multibyte characters when given a UTF-8 subject string. It's fairly clear if you read the documentation for libpcre: In order process UTF-8 strings, you must build PCRE to include UTF-8 support in the code, and, in addition, you must call pcre_compile() with the PCRE_UTF8 option flag, or the pattern must start with the sequence (*UTF8). When either of these is the case, both the pattern and any subject strings that are matched against it are treated as UTF-8 strings instead of strings of 1-byte characters. [from http://www.pcre.org/pcre.txt] ---- Server IP: 92.48.74.199 Probable Submitter: 87.194.177.60 ---- Manual Page -- http://www.php.net/manual/en/reference.pcre.pattern.modifiers.php Edit -- https://master.php.net/note/edit/103348 Del: integrated -- https://master.php.net/note/delete/103348/integrated Del: useless -- https://master.php.net/note/delete/103348/useless Del: bad code -- https://master.php.net/note/delete/103348/bad+code Del: spam -- https://master.php.net/note/delete/103348/spam Del: non-english -- https://master.php.net/note/delete/103348/non-english Del: in docs -- https://master.php.net/note/delete/103348/in+docs Del: other reasons-- https://master.php.net/note/delete/103348 Reject -- https://master.php.net/note/reject/103348 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#178634) next »