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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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 11:01:30 2024 UTC