RE: [PHP-DB] Find and replace in a string
| From: | John W. Holmes | Date: | Mon, 27 Jan 2003 03:42:26 +0000 |
| Subject: | RE: [PHP-DB] Find and replace in a string | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-25155@lists.php.net to get a copy of this message | ||
> I have a sting that contains some occurances of "{...}" sub-strings,
where
> "...." is some text.
> Which is the way to find and replace the "{...}" with an other of my
own.
> This sub-strings start with "{" and end with "}".
If you know what the text is between { and }, then use
$new_str = str_replace("{test}","replacement",$old_str);
If you don't, then you can use a regular expression to match and replace
it.
---John Holmes...