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
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: ruben at lingo dot com dot mx
New email:
PHP Version: OS:

 

 [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

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 06:01:30 2024 UTC