<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; ">Oi Daniel,<DIV><BR><DIV><DIV>On Apr 17, 2007, at 8:45 PM, Daniel Projetos wrote:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite"><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Opa!</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Um olá para todos da lista, snift... não tive boas vindas calorosas hehehehe<SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">e já estou na lista a mais de 1 mês só de olho! Meu nome é Daniel Bunduki,<SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">programa Perl para uso na web mesmo e estou com a seguinte dúvida:</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Estou usando: $descricoes[$x] =~ s/&lt;([^&gt;]|\n)*&gt;//g;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Isso faz com que todas as tags em HTML sejam TIRADAS da minha variável<SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">(lista simples).</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Gostaria de antes disto, como se trata apenas de um tag: &lt;img src=/xxx ...<SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">... ... &gt;.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Coloca-lá em outra variável.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Resumindo, uma expressão regular onde consiga tirar apenas a TAG HTML para<SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">outra variável...</DIV></BLOCKQUOTE><BR></DIV><DIV>Poderia perguntar-te por que razão estás usando expressões regulares para parsing de HTML? Quantas vezes repetimos a mesma coisa?! Nelson, colé o mantra prá isso :-D?</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Repitamos: "Não devemos fazer parser de HTML com expressões regulares, não devemos fazer parser de HTML com expressões regulares, não devemos fazer parser de..."</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Para fazer isso de uma maneira fácil, podes utilizar o HTML::TreeBuilder::XPath:</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>&lt;code&gt;</DIV><DIV>use strict;</DIV><DIV>use warnings;</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>use HTML::TreeBuilder::XPath;</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>my $tree = HTML::TreeBuilder::XPath-&gt;new;</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>$tree-&gt;parse_file( \*DATA );</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>my @imgs = $tree-&gt;findnodes('//img');</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>for my $img (@imgs) {</DIV><DIV>    print $img-&gt;attr('src'), $/;</DIV><DIV>}</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>__DATA__</DIV><DIV>&lt;html&gt;</DIV><DIV>&lt;img src="teste1.gif" /&gt;</DIV><DIV>&lt;img src="teste2.gif" /&gt;</DIV><DIV>&lt;/html&gt;</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>&lt;/code&gt;</DIV><BR><DIV> <SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Lucida Grande; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><DIV>--</DIV><DIV>Igor Sutton</DIV><DIV><A href="mailto:igor.sutton@gmail.com">igor.sutton@gmail.com</A></DIV><DIV><BR class="khtml-block-placeholder"></DIV><BR class="Apple-interchange-newline"></SPAN> </DIV><BR></DIV></BODY></HTML>