#10218 [Com]: preg_replace() with mod e, refs $10 - $19 don't work
| From: | animal-cartoon689 at hotmail dot com | Date: | Tue, 20 Jul 2004 15:00:18 +0000 |
| Subject: | #10218 [Com]: preg_replace() with mod e, refs $10 - $19 don't work | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-62770@lists.php.net to get a copy of this message | ||
ID: 10218
Comment by: animal-cartoon689 at hotmail dot com
Reported By: karen at crazygrrl dot com
Status: Closed
Bug Type: *Regular Expressions
Operating System: FreeBSD 4.2
PHP Version: 4.0.4pl1
New Comment:
<a href=http://an-rippedfemdom-blo.da.ru>cartoon
animal</a>
Previous Comments:
------------------------------------------------------------------------
[2001-04-16 05:12:56] jmoore@php.net
Fixed in CVS. Andrei forgot to close it.
- James
------------------------------------------------------------------------
[2001-04-06 20:39:07] karen at crazygrrl dot 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'
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=10218&edit=1