You are here: Re: [PHP] [HAB] str_replace « PHP « IT news, forums, messages
Re: [PHP] [HAB] str_replace

Posted by Jochem Maas on 02/22/05 23:41

Bret Hughes wrote:
> On Tue, 2005-02-22 at 09:59, OOzy Pal wrote:
>
>>Dears
>>
>>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);
>>
>>Thank you
>>
>>
>
>
> IIRC str_replace does not use any type of globbing. You need to use one
> of the function that uses regular expresions I prefer preg_replace
> personally. regexes can get complicated looking pretty quick but are an
> incredibly powerful mechanism once you understand even the rudiments. I
> would place my self in that catagory.


echo preg_replace("/{\!(.*)\!}/","{!REPLACED!}","erg9872et {!---SUPERDUPER---!}gjhgo6*%^*&^%Y)7ygr9 y2343");

 

Navigation:

[Reply to this 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

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