Bug #2104 Updated: ereg_replace doesn't work with $

From: Date: Fri, 12 Nov 1999 01:04:55 +0000
Subject: Bug #2104 Updated: ereg_replace doesn't work with $
Groups: php.dev 
Request: Send a blank email to php-dev+get-12326@lists.php.net to get a copy of this message
ID: 2104 Updated by: joey Reported By: craig@starpoint.net Status: Open Bug Type: Misbehaving function Assigned To: Comments: This is bcz "$" is a meta character in regular expressions. It means "end of line". So you are telling ereg_replace to replace "end of line" (usually the point between the last char and the \n) with "". (This is what it already is!) In the case of "\$", the php parser gobbles the \ before ereg can see it. Quick answer: Try <? $s = "$55"; $f = ereg_replace("\\$", "", $s); print "$f\n"; ?> Real solution: Read the manual really well, and I would suggest Jeff Friedl's book on regex "Mastering Regular Expressions", from O'Reilly and Assoc. :) Full Bug description available at: http://bugs.php.net/?id=2104

« previous php.dev (#12326) next »