Reply to Re: strip tags with contents n times

Your name:

Reply:


Posted by Philipp Grassl on 05/22/07 10:42

Hm, you mean like
---
$n=2;
preg_replace("'\<[^\>]*\>[^\<]*\<\/[^\>]*\>'si", "", $someBigString, $n);
---
?

Alternatively, if you'd like to limit the Tag to a specific one you
could also do
---
$n=2;
preg_replace("'\<someTag\>[^\<]*\<\/someTag\>'si", "", $someBigString, $n);
---

Or did I misunderstand you here...

Peter Parker schrieb:
> What is the best way to delete tags n times from either the beginning or the
> end of a String? For example, to delete "someString1" and "someString2"
> along with surrounding <someTag>'s with n=2 and processing direction is from
> beginning.
>
> $someBigString="<someTag>someString1</someTag><someTag>someString2</someTag><someTag>someString3</someTag>";
>
> I was thinking about use preg_replace() to replace "/</tag><tag/" with ""
> but wasn't sure how, especially about the n times and direction of
> processing. Any suggestion? Is using prreg_replace() the best way to
> accomplish this task? Thanks.
>
>

[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

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