#17616 [Opn->Ver]: backslash characters handled oddly in preg_replace

From: Date: Thu, 12 Sep 2002 00:44:28 +0000
Subject: #17616 [Opn->Ver]: backslash characters handled oddly in preg_replace
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-19194@lists.php.net to get a copy of this message
ID: 17616 Updated by: iliaa@php.net Reported By: john43@temple.edu -Status: Open +Status: Verified Bug Type: PCRE related Operating System: linux 2.4.14, pcre -PHP Version: 4.1.2 +PHP Version: 4.3.0-dev New Comment: updated version. Previous Comments: ------------------------------------------------------------------------ [2002-06-05 18:17:27] john43@temple.edu Below are two calls to preg_replace() with different replacement strings. For some reason, they both return the same string. $s = "A backslash: \\ "; $s1 = preg_replace("/\\\\/", "\\\\\\", $s); $s2 = preg_replace("/\\\\/", "\\\\\\\\", $s); echo "s : $s \n"; echo "s1: $s1 \n"; echo "s2: $s2 \n"; ------------------ Output: s : A backslash: \ s1: A backslash: \\ s2: A backslash: \\ ------------------ My configuration: './configure' '--with-gnu-ld' '--with-apxs=/usr/local/apache/bin/apxs' '--with-mysql=/usr/local/mysql' ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=17616&edit=1

« previous php.bugs (#19194) next »