php-general | 2000071
Date: 07/08/00
- Next message: Evan Raskob: "Re: [PHP] XML inside a file"
- Previous message: Adrian Teasdale: "Re: [PHP] PHP: date - in addtion"
- In reply to: Brian Clark: "[PHP] ereg_replace()"
- Next in thread: Brian Clark: "Re: [PHP] ereg_replace()"
- Reply: Brian Clark: "Re: [PHP] ereg_replace()"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Brian Clark wrote:
>
> var $version = ereg_replace("[\$]", "", '$Revision: 1.8 $');
>
> The above $version holds the string Revision: 1.8
>
> var $version = ereg_replace("\$", "", '$Revision: 1.8 $');
>
> The above $version holds nothing.
>
> Why does ereg_replace() require [] around the pattern?
It doesn't, but if you use double quotes you need to escape twice (once
for the php parser and once to tell ereg its really the dollar sign and
not an end-of-line metacharacter):
$version = ereg_replace("\\\$", "", '$Revision: 1.8 $');
or use single quotes:
$version = ereg_replace('\$', "", '$Revision: 1.8 $');
Ciao,
Andreas
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe <email protected> For additional commands, e-mail: php-general-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Evan Raskob: "Re: [PHP] XML inside a file"
- Previous message: Adrian Teasdale: "Re: [PHP] PHP: date - in addtion"
- In reply to: Brian Clark: "[PHP] ereg_replace()"
- Next in thread: Brian Clark: "Re: [PHP] ereg_replace()"
- Reply: Brian Clark: "Re: [PHP] ereg_replace()"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

