Re: Incomprehension with preg_match and utf8
| From: | Pierre Joye | Date: | Tue, 06 Nov 2012 10:18:48 +0000 |
| Subject: | Re: Incomprehension with preg_match and utf8 | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-63760@lists.php.net to get a copy of this message | ||
On Tue, Nov 6, 2012 at 11:17 AM, Pierre Joye <pierre.php@gmail.com> wrote:
> On Mon, Nov 5, 2012 at 10:57 AM, Jean-Sébastien Hedde
> <jeanseb@au-fil-du.net> wrote:
>> Hi,
>>
>> I'm facing an issue with preg_match and an UTF8 string.
>>
>> The pattern is : /^[[:alnum:]\s\-\'%]+$/u
>> The string : Régis
>>
>> If I read the manual preg_match should return 0 ("In UTF-8 mode, characters
>> with values greater than 128 do not match any of the POSIX character
>> classes.") but I've got 1 in some case :
>>
>> On a Windows host
>> php 5.2.12 - (PCRE 7.9 2009-04-11) : preg_match === 1
builtin pcre (btw, forget 5.2, go with at least 5.3).
>> On the same centos host :
>> php 5.2.10 (Rémi's RPM) - (PCRE 6.6 06-Feb-2006) : preg_match === 0
system's pcre
>> php 5.4.8 (my build) - (PCRE 8.12 2011-01-15) : preg_match === 1
builtin pcre
>> On an other Centos host :
>> php 5.4.0 (Rémi's RPM) - (PCRE 7.8 2008-09-05)
system's pcre
Cheers,
--
Pierre
@pierrejoye