Bug #73573 [Opn->Nab]: Сase-insensitive search error
| From: | requinix@php.net | Date: | Mon, 21 Nov 2016 11:03:27 +0000 |
| Subject: | Bug #73573 [Opn->Nab]: Сase-insensitive search error | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-205507@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=73573&edit=1
ID: 73573
Updated by: requinix@php.net
Reported by: ruk at mgpu dot ru
Summary: Сase-insensitive search error
-Status: Open
+Status: Not a bug
Type: Bug
-Package: *Regular Expressions
+Package: PCRE related
Operating System: Windows Server 2012 R2
PHP Version: 7.0.13
Block user comment: N
Private report: N
New Comment:
(Expected and Actual are backwards)
To match non-ASCII characters you must use UTF-8 and the /u flag.
'/^[a-zа-Ñ]+$/iu' - only if the file is in UTF-8 encoding
"/^[a-z\u{0430}-\u{044F}]+$/iu"
https://3v4l.org/t4h9t
Previous Comments:
------------------------------------------------------------------------
[2016-11-21 10:32:36] ruk at mgpu dot ru
Description:
------------
In line with the processing of the Cyrillic alphabet in the regular expression key /i
(case-insensitive search) error occurs
Windows Server 2012 R2
IIS 8.5
PHP 7.0.9 x64
Test script:
---------------
<?php
header('Content-Type: text/plain; charset=windows-1251');
$RegularExpression = '/^[a-zа-Ñ]+$/i';
$TestStrArray = array('ABC', 'abc', 'ÐÐÐ',
'абв');
foreach ($TestStrArray as $TestStr)
{
$Result = preg_match($RegularExpression, $TestStr);
echo $TestStr;
if ($Result === false)
{
echo ' - Error'."\r\n";
}
else
{
echo ' - '.($Result === 0 ? 'not found' :
'found')."\r\n";
}
} // foreach
?>
Expected result:
----------------
ABC - found
abc - found
ÐÐÐ - not found
абв - found
Actual result:
--------------
ABC - found
abc - found
ÐÐÐ - found
абв - found
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=73573&edit=1