Hi,
can anyone help me with this parsing riddle:
I want to REMOVE all occurrences of a certain word from a text, but only if such word is between certain opening and closing tags.
Namely, the word I want to arbitrary remove is "<row>" and the opening tag is "<ul>", closing: "</ul>". The example text, which is some sort of altered HTML is given at the end of this message.
I want to remove all "<row>"s that are inside the <ul>...</ul> , whether these tags are nested or not. But definitely I want to keep those "<row>"s that are outside any "<ul>...</ul>".
To be even more precise I left the "<ROW>"s that need to be removed in the UPPERCASE, while those that need to remain in lowercase; but imagine all of them are lowercase, so we can't use the CAPS as the condition.
Thank you.
Nenad
<row><br> </font><row><br>
<li type="square"><font face="Arial" size="1"><a href="/unmegafono/compa-para-arqurbpaisaje-b-noche-26778.html?LINEFMT=2"><b>COMPA PARA ARQ,URB,PAISAJE B NOCHE</b></a> - <b>MARI,EUGE</b> - 17/03/2010 10:59 <script>Check("17/03/2010 13:59");</script><br>
<ul> </font><ROW><br>
<li type="square"><font face="Arial" size="1"><a href="/unmegafono/re-compa-para-arqurbpaisaje-b-noche-26800.html?LINEFMT=2"><b>Re: COMPA PARA ARQ,URB,PAISAJE B NOCHE</b></a> - <b>lau</b> - 17/03/2010 12:37 <script>Check("17/03/2010 15:37");</script><br> </font><ROW><br>
<li type="square"><font face="Arial" size="1"><a href="/unmegafono/re-compa-para-arqurbpaisaje-b-noche-26799.html?LINEFMT=2"><b>Re: COMPA PARA ARQ,URB,PAISAJE B NOCHE</b></a> - <b>lau</b> - 17/03/2010 12:33 <script>Check("17/03/2010 15:33");</script><br>
<ul> </font><ROW><br>
<li type="square"><font face="Arial" size="1"><a href="/unmegafono/re-compa-para-arqurbpaisaje-b-noche-26806.html?LINEFMT=2"><b>Re: COMPA PARA ARQ,URB,PAISAJE B NOCHE</b></a> - <b>MARI Y E</b> - 17/03/2010 13:35 <script>Check("17/03/2010 16:35");</script><br>
<ul> </font><ROW><br>
<li type="square"><font face="Arial" size="1"><a href="/unmegafono/re-compa-para-arqurbpaisaje-b-noche-26808.html?LINEFMT=2"><b>Re: COMPA PARA ARQ,URB,PAISAJE B NOCHE</b></a> - <b>MARI Y E</b> - 17/03/2010 13:37 <script>Check("17/03/2010 16:37");</script><br> </font><ROW><br>
<li type="square"><font face="Arial" size="1"><a href="/unmegafono/re-compa-para-arqurbpaisaje-b-noche-26807.html?LINEFMT=2"><b>Re: COMPA PARA ARQ,URB,PAISAJE B NOCHE (s/t)</b></a> - <b>MARI Y E</b> - 17/03/2010 13:36 <script>Check("17/03/2010 16:36");</script><br>
</ul>
</ul>
</ul> </font><row><br>
<li type="square"><font face="Arial" size="1"><a href="/unmegafono/construcciones-i-a-se-adhiere-al-26805.html?LINEFMT=2"><b>construcciones I A se adhiere al paeo???? (s/t)</b></a> - <b>flo</b> - 17/03/2010 13:33 <script>Check("17/03/2010 16:33");</script><br> </font><row><br>
<li type="square"><font face="Arial" size="1"><a href="/unmegafono/paro-26804.html?LINEFMT=2"><b>paro?????</b></a> - <b>juli</b> - 17/03/2010 13:31 <script>Check("17/03/2010 16:31");</script><br> </font><row><br>
<li type="square"><font face="Arial" size="1"><a href="/unmegafono/gestion-ambiental-del-paisajenecesito-26803.html?LINEFMT=2"><b>GESTION AMBIENTAL DEL PAISAJE...NECESITO INFORMACION</b></a> - <b>juan</b> - 17/03/2010 13:18 <script>Check("17/03/2010 16:18");</script><br> </font><row><br>
<li type="square"><font face="Arial" size="1"><a href="/unmegafono/paro-26802.html?LINEFMT=2"><b>paro</b></a> - <b>jesi</b> - 17/03/2010 12:56 <script>Check("17/03/2010 15:56");</script><br> </font><row><br>
<li type="square"><font face="Arial" size="1"><a href="/unmegafono/cambio-de-horario-dr-topografia-26796.html?LINEFMT=2"><b>cambio de horario dr topografia</b></a> - <b>pablo</b> - 17/03/2010 12:18 <script>Check("17/03/2010 15:18");</script><br>
<ul> </font><ROW><br>
<li type="square"><font face="Arial" size="1"><a href="/unmegafono/re-cambio-de-horario-dr-topografia-26801.html?LINEFMT=2"><b>Re: cambio de horario dr topografia</b></a> - <b>luis</b> - 17/03/2010 12:51 <script>Check("17/03/2010 15:51");</script><br>
</ul> </font><row><br>
<li type="square"><font face="Arial" size="1"><a href="/unmegafono/cambio-de-turno-26793.html?LINEFMT=2"><b>CAMBIO DE TURNO</b></a> - <b>Paola Sembaj</b> - 17/03/2010 12:11 <script>Check("17/03/2010 15:11");</script><br>
<ul> </font><ROW><br>
<li type="square"><font face="Arial" size="1"><a href="/unmegafono/re-cambio-de-turno-construcciones-26798.html?LINEFMT=2"><b>Re: CAMBIO DE TURNO CONSTRUCCIONES 2007</b></a> - <b>Paola Sembaj</b> - 17/03/2010 12:26 <script>Check("17/03/2010 15:26");</script><br>
</ul> </font><row><br>
can anyone help me with this parsing riddle:
I want to REMOVE all occurrences of a certain word from a text, but only if such word is between certain opening and closing tags.
Namely, the word I want to arbitrary remove is "<row>" and the opening tag is "<ul>", closing: "</ul>". The example text, which is some sort of altered HTML is given at the end of this message.
I want to remove all "<row>"s that are inside the <ul>...</ul> , whether these tags are nested or not. But definitely I want to keep those "<row>"s that are outside any "<ul>...</ul>".
To be even more precise I left the "<ROW>"s that need to be removed in the UPPERCASE, while those that need to remain in lowercase; but imagine all of them are lowercase, so we can't use the CAPS as the condition.
Thank you.
Nenad
<row><br> </font><row><br>
<li type="square"><font face="Arial" size="1"><a href="/unmegafono/compa-para-arqurbpaisaje-b-noche-26778.html?LINEFMT=2"><b>COMPA PARA ARQ,URB,PAISAJE B NOCHE</b></a> - <b>MARI,EUGE</b> - 17/03/2010 10:59 <script>Check("17/03/2010 13:59");</script><br>
<ul> </font><ROW><br>
<li type="square"><font face="Arial" size="1"><a href="/unmegafono/re-compa-para-arqurbpaisaje-b-noche-26800.html?LINEFMT=2"><b>Re: COMPA PARA ARQ,URB,PAISAJE B NOCHE</b></a> - <b>lau</b> - 17/03/2010 12:37 <script>Check("17/03/2010 15:37");</script><br> </font><ROW><br>
<li type="square"><font face="Arial" size="1"><a href="/unmegafono/re-compa-para-arqurbpaisaje-b-noche-26799.html?LINEFMT=2"><b>Re: COMPA PARA ARQ,URB,PAISAJE B NOCHE</b></a> - <b>lau</b> - 17/03/2010 12:33 <script>Check("17/03/2010 15:33");</script><br>
<ul> </font><ROW><br>
<li type="square"><font face="Arial" size="1"><a href="/unmegafono/re-compa-para-arqurbpaisaje-b-noche-26806.html?LINEFMT=2"><b>Re: COMPA PARA ARQ,URB,PAISAJE B NOCHE</b></a> - <b>MARI Y E</b> - 17/03/2010 13:35 <script>Check("17/03/2010 16:35");</script><br>
<ul> </font><ROW><br>
<li type="square"><font face="Arial" size="1"><a href="/unmegafono/re-compa-para-arqurbpaisaje-b-noche-26808.html?LINEFMT=2"><b>Re: COMPA PARA ARQ,URB,PAISAJE B NOCHE</b></a> - <b>MARI Y E</b> - 17/03/2010 13:37 <script>Check("17/03/2010 16:37");</script><br> </font><ROW><br>
<li type="square"><font face="Arial" size="1"><a href="/unmegafono/re-compa-para-arqurbpaisaje-b-noche-26807.html?LINEFMT=2"><b>Re: COMPA PARA ARQ,URB,PAISAJE B NOCHE (s/t)</b></a> - <b>MARI Y E</b> - 17/03/2010 13:36 <script>Check("17/03/2010 16:36");</script><br>
</ul>
</ul>
</ul> </font><row><br>
<li type="square"><font face="Arial" size="1"><a href="/unmegafono/construcciones-i-a-se-adhiere-al-26805.html?LINEFMT=2"><b>construcciones I A se adhiere al paeo???? (s/t)</b></a> - <b>flo</b> - 17/03/2010 13:33 <script>Check("17/03/2010 16:33");</script><br> </font><row><br>
<li type="square"><font face="Arial" size="1"><a href="/unmegafono/paro-26804.html?LINEFMT=2"><b>paro?????</b></a> - <b>juli</b> - 17/03/2010 13:31 <script>Check("17/03/2010 16:31");</script><br> </font><row><br>
<li type="square"><font face="Arial" size="1"><a href="/unmegafono/gestion-ambiental-del-paisajenecesito-26803.html?LINEFMT=2"><b>GESTION AMBIENTAL DEL PAISAJE...NECESITO INFORMACION</b></a> - <b>juan</b> - 17/03/2010 13:18 <script>Check("17/03/2010 16:18");</script><br> </font><row><br>
<li type="square"><font face="Arial" size="1"><a href="/unmegafono/paro-26802.html?LINEFMT=2"><b>paro</b></a> - <b>jesi</b> - 17/03/2010 12:56 <script>Check("17/03/2010 15:56");</script><br> </font><row><br>
<li type="square"><font face="Arial" size="1"><a href="/unmegafono/cambio-de-horario-dr-topografia-26796.html?LINEFMT=2"><b>cambio de horario dr topografia</b></a> - <b>pablo</b> - 17/03/2010 12:18 <script>Check("17/03/2010 15:18");</script><br>
<ul> </font><ROW><br>
<li type="square"><font face="Arial" size="1"><a href="/unmegafono/re-cambio-de-horario-dr-topografia-26801.html?LINEFMT=2"><b>Re: cambio de horario dr topografia</b></a> - <b>luis</b> - 17/03/2010 12:51 <script>Check("17/03/2010 15:51");</script><br>
</ul> </font><row><br>
<li type="square"><font face="Arial" size="1"><a href="/unmegafono/cambio-de-turno-26793.html?LINEFMT=2"><b>CAMBIO DE TURNO</b></a> - <b>Paola Sembaj</b> - 17/03/2010 12:11 <script>Check("17/03/2010 15:11");</script><br>
<ul> </font><ROW><br>
<li type="square"><font face="Arial" size="1"><a href="/unmegafono/re-cambio-de-turno-construcciones-26798.html?LINEFMT=2"><b>Re: CAMBIO DE TURNO CONSTRUCCIONES 2007</b></a> - <b>Paola Sembaj</b> - 17/03/2010 12:26 <script>Check("17/03/2010 15:26");</script><br>
</ul> </font><row><br>