note 46798 added to ref.pcre
| From: | NedBaldessin at osu1 dot php dot net | Date: | Sun, 24 Oct 2004 01:08:38 +0000 |
| Subject: | note 46798 added to ref.pcre | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-79005@lists.php.net to get a copy of this message | ||
If you want to perform regular expressions on Unicode strings, the PCRE functions will NOT be of any
help. You need to use the Multibyte extension : mb_ereg(), mb_eregi(), pb_ereg_replace() and so on.
When doing so, be carefull to set the default text encoding to the same encoding used by the text
you are searching and replacing in. You can do that with the mb_regex_encoding() function. You will
probably also want to set the default encoding for the other mb_* string functions with
mb_internal_encoding().
So when dealing with, say, french text, I start with these :
<?php
mb_internal_encoding('UTF-8');
mb_regex_encoding('UTF-8');
setlocale(LC_ALL, 'fr-fr');
?>
----
Manual Page -- http://www.php.net/manual/en/ref.pcre.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+46798
Delete -- http://master.php.net/manage/user-notes.php?action=delete+46798&report=yes
Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+46798&report=yes&reason=bad+code
Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+46798&report=yes&reason=spam
Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+46798&report=yes&reason=useless+example
Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+46798&report=yes&reason=contains+commercial+links
Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+46798&report=yes&reason=useless+note
Reject -- http://master.php.net/manage/user-notes.php?action=reject+46798&report=yes
Search -- http://master.php.net/manage/user-notes.php