Posted by Matthew Weier O'Phinney on 02/22/05 18:30
* OOzy Pal <oozypal@yahoo.com>:
> I am trying replace anything between '{!' and '!}' i.e {!A!} and {!B!}
> and {!ABC!} with XYZ. I tried the following but no help. Can anyone
> help?
>
> $this->template=str_replace("{!*!}","XYZ",$this->template);
str_replace() should be used with static strings; you're going to need a
regular expression function. Try:
$this->template = preg_replace('/\{!\(.*?)!\}/', '{!XYZ!}', $this->template);
--
Matthew Weier O'Phinney | WEBSITES:
Webmaster and IT Specialist | http://www.garden.org
National Gardening Association | http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org
mailto:matthew@garden.org | http://vermontbotanical.org
[Back to original message]
|