Re: need to change $ char in string
| From: | hugh danaher | Date: | Sat, 29 Jun 2002 22:09:15 +0000 |
| Subject: | Re: need to change $ char in string | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-104533@lists.php.net to get a copy of this message | ||
try double \\ to escape the special characters used by php for variables and
what not. I think I read it here on a previous post.
Hope this helps
Hugh
----- Original Message -----
From: "Beverly Steiner" <steiner277@charter.net>
To: "PHP List" <php-general@lists.php.net>
Sent: Saturday, June 29, 2002 7:58 AM
Subject: [PHP] need to change $ char in string
> I've tried everything I can think of to change a dallar sign in a string
to
> something else or to split the string on the $ but I can't the the
> information that comes after the $.
>
> Typical string contains: 1.2$General/ms1.zip
>
> when I try:
> $new_string = preg_replace("/\$/", "%", $test_string);
>
> or (trying to avoid specifying the $):
> $new_string = preg_replace("/(\d\.\d{1,2})\D(\w.*$)/", "\1%\2",
> $test_string);
>
> echo "new_string is $new_string"; prints new_string is 1.2
>
> Has anyone solved this problem?
>
> Thanx,
>
> Bev
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>