note 88128 added to function.preg-match

From: Date: Mon, 12 Jan 2009 10:47:23 +0000
Subject: note 88128 added to function.preg-match
Groups: php.notes 
Request: Send a blank email to php-notes+get-149083@lists.php.net to get a copy of this message
There is an problem with PREG_OFFSET_CAPTURE flag and multibyte strings - it return number of bytes, rather than number of characters. So, if you want to use it for example to truncate text around found expression using mb_substr, you cant use offset number (because mb_substr DOES count characters, not bytes). With use of standard substr it seems it works, but sometimes it "slice multibyte character in middle", so you get invalid character displayed. I havent found sufficient solution yet. ---- Server IP: 212.24.129.51 Probable Submitter: 82.208.37.177 ---- Manual Page -- http://www.php.net/manual/en/function.preg-match.php Edit -- https://master.php.net/note/edit/88128 Del: integrated -- https://master.php.net/note/delete/88128/integrated Del: useless -- https://master.php.net/note/delete/88128/useless Del: bad code -- https://master.php.net/note/delete/88128/bad+code Del: spam -- https://master.php.net/note/delete/88128/spam Del: non-english -- https://master.php.net/note/delete/88128/non-english Del: in docs -- https://master.php.net/note/delete/88128/in+docs Del: other reasons-- https://master.php.net/note/delete/88128 Reject -- https://master.php.net/note/reject/88128 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#149083) next »