Reply to Re: [HAB] str_replace

Your name:

Reply:


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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация