RE: [PHP] preg_replace
| From: | Jack Dempsey | Date: | Fri, 05 Oct 2001 18:23:28 +0000 |
| Subject: | RE: [PHP] preg_replace | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-70123@lists.php.net to get a copy of this message | ||
http://php.net/str_replace
if you're just replacing a static string, this will be faster and
easier...only use regex's when you really need them
jack
-----Original Message-----
From: W. Kiecksee [mailto:thunderman@younglab.de]
Sent: Friday, October 05, 2001 2:17 PM
To: php-general@lists.php.net
Subject: [PHP] preg_replace
Hello!
I just want to replace a string with another, but I have problems, when the
string contains a [ or something similar. I just need a method to replace
"[cool]" with "text". When I use:
$mustbereplaced = "[cool]";
$message = preg_replace("/$mustbereplaced/", "hello", $message);
only cool will be replaced with hello, but the [ and ] is still there.
When I use $message = preg_replace("/$mustbereplaced/e", "hello", $message);
nothing happens.
What must I change, that EVERY string will be replaced?
Hope someone can help me,
W. Kiecksee
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net