[Cascavel-pm] Match

Lorn lorn.br em gmail.com
Quarta Novembro 9 09:58:20 PST 2005


Bom, "descobri" um jeito que funcionou mais ou menos..
2 while (<>)
3 {
4 if (m{ \[ (\w{3}) \s* (\w{3}) \s* (\d{2}) \s*
5 (\d{2}:\d{2}:\d{2})\s*
6 (\d{4}) \]
7 (\w*) \/ (\w*) /// Info(\(\d*\))
8 \r
9 (\s*)
10 }sxm
11 ){
12 print "OK\n";
13 print "$8\n";
14 print "$9\n";
15 print "$10\n";
16
17 }}


On 11/9/05, Daniel Ruoso <daniel em ruoso.com> wrote:
>
> Em Qua, 2005-11-09 às 14:38 -0300, Luis Campos de Carvalho escreveu:
> > --- Daniel Ruoso <daniel em ruoso.com> escreveu:
> > > Em Qua, 2005-11-09 às 10:15 -0300, Lorn escreveu:
> > > > Alguem ai sabe como eu pego uma quebra de linha com o "match" ?
> > > > eu tenho o seguinte problema
> > >
> > > não seria a falta do modificador "s" no final?
> > >
> > > tipo m!sdfoasdfpo!s
> > Mas /s não é necessário para matches em múltiplas linhas. /m é que é. /s
> indica o contrário...
>
> acho que não...
>
> ruoso em cajazeiras:~$ perl
> use strict;
> use warnings;
> my $test = "This is a string with\na new line";
> if ($test =~ /with.a new line/) {
> print "Teste 1 ok".$/;
> }
> if ($test =~ /with.a new line/s) {
> print "Teste 2 ok".$/;
> }
> if ($test =~ /with.a new line/m) {
> print "Teste 3 ok".$/;
> }
> Teste 2 ok
> ruoso em cajazeiras:~$
>
> _______________________________________________
> Cascavel-pm mailing list
> Cascavel-pm em pm.org
> http://mail.pm.org/mailman/listinfo/cascavel-pm
>



--
Lorn
- Slackware Linux
www.slackwarezine.com.br <http://www.slackwarezine.com.br>
-------------- Próxima Parte ----------
Um anexo em HTML foi limpo...
URL: http://mail.pm.org/pipermail/cascavel-pm/attachments/20051109/d6531bd9/attachment.html


Mais detalhes sobre a lista de discussão Cascavel-pm