|
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]
|