#42298 [Asn->Csd]: preg_match with /u gives different results for \S\S and \S{2}

From: Date: Sat, 01 Sep 2007 17:54:13 +0000
Subject: #42298 [Asn->Csd]: preg_match with /u gives different results for \S\S and \S{2}
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-116959@lists.php.net to get a copy of this message
ID: 42298 Updated by: nlopess@php.net Reported By: matthew-php at dracos dot co dot uk -Status: Assigned +Status: Closed Bug Type: PCRE related Operating System: Windows XP PHP Version: 5CVS-2007-08-14 (snap) Assigned To: nlopess New Comment: bug fixed in PCRE 7.3. I've upgraded the bundled PCRE package in php 5.2 and 6 branches. Previous Comments: ------------------------------------------------------------------------ [2007-08-15 09:02:22] nlopess@php.net submited upstream: http://bugs.exim.org/580 I will provide more feedback when I end my vacations. ------------------------------------------------------------------------ [2007-08-15 08:43:03] jani@php.net Assigned to PCRE maintainer. ------------------------------------------------------------------------ [2007-08-14 16:46:48] matthew-php at dracos dot co dot uk Description: ------------ When using the /u modifier, preg_match, preg_match_all, and preg_replace all give incorrect results using /\S{2}/u but work fine with /\S\S/u which should be equivalent. Reproduce code: --------------- $s = "A\xc2\xa3BC"; preg_match_all('/\S\S/u', $s, $m); print_r($m[0]); preg_match_all('/\S{2}/u', $s, $m); print_r($m[0]); Expected result: ---------------- Array ( [0] => A£ [1] => BC ) Array ( [0] => A£ [1] => BC ) Actual result: -------------- Array ( [0] => A£ [1] => BC ) Array ( [0] => A [1] => ) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=42298&edit=1

« previous php.bugs (#116959) next »