<div dir="ltr">Se você RTFM (perldoc perlre), encontrará os quatro possíveis<br>
caracteres que modificam o comportamento global da expressão regular:<br>
<br>
i<br>
 &nbsp; &nbsp;Do case-insensitive pattern matching.<br>
 &nbsp; &nbsp;If use locale is in effect, the case map is taken from the current<br>
 &nbsp; &nbsp;locale. See the perllocale manpage.<br>
<br>
m<br>
 &nbsp; &nbsp;Treat string as multiple lines. That is, change ``^&#39;&#39; and ``$&#39;&#39;<br>
from matching<br>
 &nbsp; &nbsp;the start or end of the string to matching the start or end of any<br>
 &nbsp; &nbsp;line anywhere within the string.<br>
<br>
s<br>
 &nbsp; &nbsp;Treat string as single line. That is, change ``.&#39;&#39; to match any character<br>
 &nbsp; &nbsp;whatsoever, even a newline, which normally it would not match.<br>
 &nbsp; &nbsp;The /s and /m modifiers both override the $* setting. That<br>
 &nbsp; &nbsp;is, no matter what $* contains, /s without /m will force<br>
 &nbsp; &nbsp;``^&#39;&#39; to match only at the beginning of the string and ``$&#39;&#39; to match<br>
 &nbsp; &nbsp;only at the end (or just before a newline at the end) of the string.<br>
 &nbsp; &nbsp;Together, as /ms, they let the ``.&#39;&#39; match any character whatsoever,<br>
 &nbsp; &nbsp;while still allowing ``^&#39;&#39; and ``$&#39;&#39; to match, respectively, just after<br>
 &nbsp; &nbsp;and just before newlines within the string.<br>
<br>
x<br>
 &nbsp; &nbsp;Extend your pattern&#39;s legibility by permitting whitespace and comments.<br><br>Obrigado Nelson.<br><br>Eu não sabia que o $data-&gt;content(), retornava um scalar, ou melhor nunca tinha pensado nisso.<br><br>&quot;NÃO PODEM SER USADAS PARA INTERPRETAR HTML OU XML.&quot;<br>
Entendi<br><br>Se você quer aprender a programar e a manipular HTML e a extrair dados
de páginas da web com isso, eu recomendo o Web::Scraper, do Tatsuhiko
Miyagawa:<br>
<br>
<a href="http://search.cpan.org/%7Emiyagawa/Web-Scraper-0.24/lib/Web/Scraper.pm" target="_blank">http://search.cpan.org/~miyagawa/Web-Scraper-0.24/lib/Web/Scraper.pm</a><br><br>Eu não consegui extrair, o que eu extrai com meu REG, usando o módulo. Pode me dar umas dicas, por favor?<br>
<br>O Gabriel me mandou estudar algumas coisas e olha -&gt;<br>m#&lt;/strong&gt;&lt;br&gt;&lt;i&gt;\((.+?)\)&lt;/i&gt;&lt;/td&gt;#ig &amp;&amp; print DATA $1,$/ foreach split(&quot;$/&quot;,$data-&gt;content());<br><br>Obrigado a todos pela atenção.<br>
<br><div class="gmail_quote">2008/9/27 Luis Motta Campos <span dir="ltr">&lt;<a href="mailto:luismottacampos@yahoo.co.uk">luismottacampos@yahoo.co.uk</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">Daniel de Oliveira Mantovani wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Boa Noite<br>
<br>
Seguinte : Se eu pegar a fonte deste site: <a href="http://www.hgcinema.com.br/programacao/index.php" target="_blank">http://www.hgcinema.com.br/programacao/index.php</a> , salvar em um txt,<br>
como no caso abaixo &quot;cinema.txt&quot;, funciona perfeitamente.<br>
<br>
open CINE,&quot;&lt;&quot;,&quot;cinema.txt&quot; or die &quot;Nao pode abrir cinema.txt\n&quot;; my<br>
@cinema = &lt;CINE&gt;; m#&lt;/strong&gt;&lt;br&gt;&lt;i&gt;\((.+?)\)&lt;/i&gt;&lt;/td&gt;# &amp;&amp; print<br>
$1,$/ foreach @cinema;<br>
<br>
Agora, se eu pego direito da Internet só pega a primeira linha. open<br>
DATA,&quot;&gt;&gt;&quot;,&quot;database.db&quot; or die &quot;Não pode abrir database.db\n&quot;; my<br>
$database = WWW::Mechanize-&gt;new(); $database-&gt;get(&#39;<a href="http://www.hgcinema.com.br/programacao/index.php%27" target="_blank">http://www.hgcinema.com.br/programacao/index.php&#39;</a>); m#&lt;/strong&gt;&lt;br&gt;&lt;i&gt;\((.+?)\)&lt;/i&gt;&lt;/td&gt;# &amp;&amp; print $1,$/ foreach $database-&gt;content;<br>

<br>
Não entendi, pois pelo que eu &quot;sei&quot; deveria funcionar da mesma forma,<br>
afinal os dois contém a mesma coisa.<br>
</blockquote>
<br></div>
Você, prá variar, não presta atenção no que está fazendo.<br>
<br>
Se você tivesse RTFM, saberia que WWW::Mechanize::content() retorna o<br>
texto *todo* em uma linha, enquanto que &quot;perldoc -f open&quot; vai te<br>
explicar que ler um arquivo texto em contexto de lista (como você fez)<br>
te retorna uma lista de elementos separados por $/ (que normalmente<br>
contém &quot;\n&quot;).<br>
<br>
Assim, você não sabe nada, não presta atenção, não lê o manual e não<br>
sabe com o que está mexendo: open() e content() retornam coisas<br>
diferentes, de formas diferentes, e você está assumindo que são iguais.<div class="Ih2E3d"><br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Então, estou me esforçando se eu não me engano eu estava falando com<br>
o Wendel um tempo atrás ou com o Blabos ou com o Gabriel, e tem um<br>
caractere que transforma tudo em uma linha só, pois acho que quando puxa direito da Internet ele não percorre todas as linhas, único<br>
problema que não lembro qual é esse caractere.<br>
</blockquote>
<br></div>
O &quot;caracter que transforma tudo em uma linha&quot; que você está procurando não existe. A gente tem uma &quot;opção de expressão regular&quot; que aplica a expressão múltiplas vezes contra uma mesma string, numa espécie de loop (/g). Mas isso não vai fazer o que você quer, também.<br>

<br>
Eu já te disse uma vez, e você continua teimando. Se você quer aprender a usar expressões regulares, precisa aprender que expressões regulares NÃO PODEM SER USADAS PARA INTERPRETAR HTML OU XML.<br>
<br>
Se você quer aprender a programar e a manipular HTML e a extrair dados de páginas da web com isso, eu recomendo o Web::Scraper, do Tatsuhiko Miyagawa:<br>
<br>
<a href="http://search.cpan.org/%7Emiyagawa/Web-Scraper-0.24/lib/Web/Scraper.pm" target="_blank">http://search.cpan.org/~miyagawa/Web-Scraper-0.24/lib/Web/Scraper.pm</a><br>
<br>
Também recomendo que você tente aprender a usar parsers prontos, como o XML::Compile, do Mark Overmeer; o XML::TreeBuilder, do Sean Burke; e até mesmo o XML::Twig, do Michael Rodriguez.<br>
<br>
Finalmente, mas não menos importante, leia alguma coisa sobre o Perl Debugger (&quot;perldoc perldebug&quot;) -- assim, você vai pelo menos conseguir dizer que estruturas de dados você tem no seu programa, e talvez consiga fazer perguntas mais inteligentes que as que você tem feito.<br>

<br>
Putamplexos.<br><font color="#888888">
-- <br>
Luis Motta Campos is a software engineer,<br>
Perl Programmer, foodie and photographer.</font><div><div></div><div class="Wj3C7c"><br>
_______________________________________________<br>
SaoPaulo-pm mailing list<br>
<a href="mailto:SaoPaulo-pm@pm.org" target="_blank">SaoPaulo-pm@pm.org</a><br>
<a href="http://mail.pm.org/mailman/listinfo/saopaulo-pm" target="_blank">http://mail.pm.org/mailman/listinfo/saopaulo-pm</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>print &quot;\x54\x68\x65\x20\x53\x69\x6c\x65\x6e\x74\x20\x47\x75\x61\x72\x64\x69\x61\x6e&quot;,$/<br>
</div>