Reply to Re: Any regex pro's out there?

Your name:

Reply:


Posted by shimmyshack on 06/05/07 01:54

On Jun 5, 2:18 am, nel <NajibKa...@gmail.com> wrote:
> I have two tags:
> <!--// Remove Begin //--> and <!--// Remove End //-->
>
> I want to use regi_replace() to remove everything between these tags.
>
> The thing is, these tags can be repeated throughout the code.
>
> <!--// Remove Begin //-->(.+)<!--// Remove End //--> works, but only
> if the tags exists once. Otherwise, it parses out everything between
> the first <!--// Remove Begin //--> and the last <!--// Remove End //--
>
> >.
>
> How could i modify this so that it will...
>
> convert: aaa<!--// Remove Begin //-->bbb <!--// Remove End //-->ccc<!--// Remove Begin //-->ddd<!--// Remove End //-->
>
> into: aaaccc
>
> ??

you need to add a rule: "remove .+ but not if .+ contains the end
marker <!--// Remove End //-->
I am assuming you are doing this inside a [webpage?] where < or
possibly <!-- will be present WITHIN the sections to be removed, so
bbb
could be
<!--comment--><b>hello</>bb
If html will not be present you could simply use a NOT instruction to
look for <
[^<]+

[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

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