php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25953 mb_eregi_replace() is not case-insensitive for multibyte characters.
Submitted: 2003-10-22 10:16 UTC Modified: 2003-10-24 13:35 UTC
Votes:14
Avg. Score:4.2 ± 1.1
Reproduced:13 of 13 (100.0%)
Same Version:1 (7.7%)
Same OS:1 (7.7%)
From: kirill at digicol dot de Assigned:
Status: Wont fix Package: mbstring related
PHP Version: 4.3.4RC2 OS: Linux Suse SuSE 8.2
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: kirill at digicol dot de
New email:
PHP Version: OS:

 

 [2003-10-22 10:16 UTC] kirill at digicol dot de
Description:
------------
The function mb_eregi_replace() is not caseinsensitive for multibyte characters.

This bug is in PHP 4.3.3 as well.

Reproduce code:
---------------
<?php
mb_regex_encoding('UTF-8');

$pattern = utf8_encode('?');
$replace = 'X';
$subject = utf8_encode('?BER ?ber');

$result = mb_eregi_replace($pattern, $replace, $subject);

echo utf8_decode($result) . "\n";
?>

Expected result:
----------------
XBER Xber

Actual result:
--------------
?BER Xber

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-10-24 13:35 UTC] moriyoshi@php.net
As of the current regex engine used by mbstring extension, all of the cyrillic / greek / arabic characters and some alphabetical characters that are not part of ascii character set such as a-umlaut (?) aren't handled correctly under case-insensitive mode. Probably the issue will be resolved in php5.

 [2012-08-22 11:49 UTC] iam at xatory dot ru
You can replace mb_eregi_replace with preg_replace with u modifier.

Example (utf-8 file encoding):
<?php
echo preg_replace('/(юникод)/iu', '<b>\\1</b>', 'Юникод удобен');
?>

As expected result is:
<b>Юникод</b> удобен
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jan 05 02:01:28 2025 UTC