php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #12752 preg_replace eats '$' characters
Submitted: 2001-08-15 00:15 UTC Modified: 2001-08-15 05:59 UTC
From: ruben at lingo dot com dot mx Assigned:
Status: Not a bug Package: PCRE related
PHP Version: 4.0.6 OS: Linux Redhat 7.1
Private report: No CVE-ID: None
 [2001-08-15 00:15 UTC] ruben at lingo dot com dot mx
The preg_replace function seems to dissapear '$' characters, and up to two more numeric characters after it. If the character after the dollar sign is not a number, it works as expected.

$string = 'sum: {token} pesos.';
$number= '$123,456.78';
$number2='$ 123,456.78';
echo  "Wrong: ".preg_replace("/\{token\}/i",$number,$string);
echo  "<br>Right: ".preg_replace("/\{token\}/i",$number2,$string);

My configure line:
'./configure' '--with-apxs' '--with-pgsql' '--without-mysql' '--with-openssl' '--enable-ftp' '--with-gd' '--enable-gd-native-ttf'

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 18:01:28 2024 UTC