Bug #10218 Updated: preg_replace() with mod e, refs $10 - $19 don't work
| From: | jmoore@php.net | Date: | Mon, 16 Apr 2001 09:12:57 +0000 |
| Subject: | Bug #10218 Updated: preg_replace() with mod e, refs $10 - $19 don't work | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-51636@lists.php.net to get a copy of this message | ||
ID: 10218
Updated by: jmoore
Reported By: karen@crazygrrl.com
Old-Status: Assigned
Status: Closed
Bug Type: *Regular Expressions
PHP Version: 4.0.4pl1
Assigned To:
Comments:
Fixed in CVS. Andrei forgot to close it.
- James
Previous Comments:
---------------------------------------------------------------------------
[2001-04-06 20:39:07] karen@crazygrrl.com
When using preg_replace() with the modifier "e", references
of the form \3 or $3 don't work correctly for the numbers
10-19, while they do for 0-9 & 20-29. A reference to $15 is
interpreted as a reference to $1 concatenated with the
number 5.
Example:
$numbers = "(one) (two) (3) (4) (5) (6) (7) (8) (9) (10)
(11) (12) (13) (14) (15#5) (16) (17) (18) (19) (20) (21)
(22) (23)";
$pat_without_mod = "/$numbers/";
$pat_with_e_mod = "/$numbers/e";
$text = "one two 3 4 5 6 7 8 9 10 11 12 13 14 15#5 16 17 18
19 20 21 22 23";
echo preg_replace($pat_without_mod, "'\1 \15 \21'",
$text);
// 'one 15#5 21'
echo preg_replace($pat_with_e_mod, "'\1 \15 \21'",
$text);
// one one5 21
echo preg_replace($pat_without_mod, "'$1 $15 $21'", $text);
// 'one 15#5 21'
echo preg_replace($pat_with_e_mod, "'$1 $15 $21'", $text);
// one one5 21
Configure line (via phpinfo() - I'm not the admin):
'./configure' '--with-apache=../apache_1.3.17'
'--with-mysql=/usr/local' '--with-jpeg-dir=../jpeg-6b'
'--with-png' '--with-gd=/usr/local' '--with-ndbm'
'--without-ttf' '--enable-safe-mode' '--enable-dbase'
'--enable-filepro' '--enable-ftp' '--disable-debug'
---------------------------------------------------------------------------
ATTENTION! Do NOT reply to this email!
To reply, use the web interface found at http://bugs.php.net/?id=10218&edit=2