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 Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
48 + 43 = ?
Subscribe to this entry?

 
 [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-2022 The PHP Group
All rights reserved.
Last updated: Thu Jan 20 03:03:35 2022 UTC