|
Posted by Piratron on 02/16/06 02:57
MaKroZ wrote:
> On Mon, 13 Feb 2006 19:09:33 +0100, Piratron wrote:
>
>> well, I'm afraid you didn't understand me. Simple str_replace function
>> wont solve my problem because I have to replace text between two html tags!
>> I can determine the position of first an last tag with a loop or
>> something and then replace the text inside it. But I have a dozens of
>> those tags so I really need a smart function to find all that
>> occurrences. What will be the faster method? The one I just mentioned or
>> using eregi_replace or preg_replace?
>
> Oh, so '{POST_CODE}' is not the pattern? OK, sorry I didn't understand you
> right. Seeking for positions of tags in a loop is a good approach too. I
> don't know which of approaches will work faster, but it can be determined
> by an experiment though. If you want to try re, here is an example for
> your problem:
>
> ereg_replace("(<!--ec1-->).*(<!--ec2-->)","\\1$repl\\2", $string);
>
> "This function scans string for matches to pattern, then replaces the
> matched text with replacement. The modified string is returned."
>
> eregi_replace is the same but it's case insensitive.
>
>
>
working perfectly.
Thanks again
--
Please visit our site at:
www.symbian-mobile.org
Regards,
Symbian-Mobile Team
Navigation:
[Reply to this message]
|