I apologize for my unclear post... this will demonstrate what I mean:

<CODE>
#!/usr/bin/perl -w
use strict;

my $line = "";

while (<DATA>)
{
    if (/^(?! [Ldf] )
          (?! LOG_INFO | dhcp | ftpd ) /x)
    {
        $line = $_;
    }
}
print "and the magic line is:\n$line\n";

__DATA__
this is a line
here is another line
LOG_INFO: This line starts with LOG_INFO
Listen, this is the line I want, it doesn't start with LOG_INFO
</CODE>


this prints here is another line.
if you change the if statement to:
if (/(?! ^[Ldf] ) (?! ^(?:LOG_INFO | dhcp | ftpd )) /)

it will do the pre-screening that you intended


dig?

> -----Original Message-----
> From: Andrea Holstein [mailto:[EMAIL PROTECTED]]
> Sent: Monday, September 10, 2001 13:53
> To: [EMAIL PROTECTED]
> Subject: Re: don't begin
> 
> 
> 
> Jeremy Vinding wrote:
> > 
> > }
> > >
> > > or if you want to be the quickest in the world, try:
> > >
> > > unless ($line =~ /^ (?! [Ldf] )
> > >                     (?! LOG_INFO | dhcp | ftpd )
> > >                  /x) {
> > >
> > >    # line doesn't start with them
> > > }
> > 
> > I believe that would also catch lines such as:
> > 
> > don't print this line, it doesn't start with LOG_INFO
> 
> Isn't it this exactly what Jorge Gonzalez wanted ?!
> He searched for the last line, which doesn't start with LOG_INFO, dhcp,
> ftpd.
> This RE finds such lines. All he has still to do is to read the line
> backwards.
> 
> But to say the truth, instead of an unless,
> there should be an if.
> 
> Greetings,
> Andrea
> 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to