Bug #11594 Updated: preg_replace is not working with backslash $
| From: | andrei@php.net | Date: | Mon, 06 Aug 2001 17:01:11 +0000 |
| Subject: | Bug #11594 Updated: preg_replace is not working with backslash $ | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-62316@lists.php.net to get a copy of this message | ||
ID: 11594
Updated by: andrei
Reported By: PWMoosman@aol.com
Old Status: Open
Status: Closed
Bug Type: PCRE related
Operating System: Solaris
PHP Version: 4.0.5
New Comment:
You need to use '\\\\$' as you replacement string.
Previous Comments:
------------------------------------------------------------------------
[2001-06-20 17:40:55] PWMoosman@aol.com
I'm trying to use preg_replace to replace $ with \$.
Here is a sample script:
<?
$data = '$_hello_$world';
$data = preg_replace('/\$/i','\$',$data);
print "data : $data\n";
?>
I expect the script to output \$_hello_\$world. However, version 4.0.5 is outputing $_hello_$world.
This worked in version 4.0.4
It possible this bug is related to bug# 10668
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=11594&edit=1