Justtechjobs.com Find a programming school near you






Online Campus Both


php-developer-list | 2001041

[PHP-DEV] PHP 4.0 Bug #10218 Updated: preg_replace() with mod e, refs $10 - $19 don't work From: andrei <email protected>
Date: 04/09/01

ID: 10218
Updated by: andrei
Reported By: karen <email protected>
Old-Status: Open
Status: Assigned
Bug Type: *Regular Expressions
Assigned To: andrei
Comments:

Previous Comments:
---------------------------------------------------------------------------

[2001-04-06 20:39:07] karen <email protected>
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

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>