Bug #12140 Updated: pcre_replace change behavior with \
| From: | andrei@php.net | Date: | Mon, 06 Aug 2001 16:58:55 +0000 |
| Subject: | Bug #12140 Updated: pcre_replace change behavior with \ | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-62314@lists.php.net to get a copy of this message | ||
ID: 12140
Updated by: andrei
Reported By: madmax@express.ru
Old Status: Open
Status: Closed
Bug Type: PCRE related
Operating System:
PHP Version: 4.0.6
New Comment:
That's right. Your \\\\\\\\ turns into \\\\ by the time PHP string parsing is done with it.
Then the extension looks at it and sees two escaped backslashes so that's what you get - two
backslashes.
In general, use str_replace() for things like that.
Previous Comments:
------------------------------------------------------------------------
[2001-07-13 08:51:59] madmax@express.ru
task:
need replace \ (one) to \\\\ (four)
On php.4.0.5 work:
$val1=preg_replace('/\\\/',"\\\\\\\\",$val);
On php 4.0.6 work:
$val1=preg_replace('/\\\/',"\\\\\\\\\\\\\\\\",$val);
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=12140&edit=1