----- Original Message -----
From: "Akshay Arora" <[EMAIL PROTECTED]>
To: "Tyler Longren" <[EMAIL PROTECTED]>
Cc: "perl-beginners" <[EMAIL PROTECTED]>
Sent: Thursday, August 09, 2001 7:24 PM
Subject: Re: result of regexps into a string
> since you know that the first thing on the log file is the IP number you
> only need to get the beginning of the line
> IP numbers have the format ddd.ddd.ddd.ddd ranging from 1 to 3 digits,
> so
> if(/$(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/) would grab the IP and put it
here should be ^ but not $.
> in $1
> the above will match IP numbers
>
> for this program, you can also use something simpler like
> if(/$(\S+)/)
> this will just grab all non space chars at the beginning of the line
>
> -Akshay
>
> Tyler Longren wrote:
> >
> > Hello everyone,
> >
> > I have a string from an apache log file:
> > 192.168.1.1 - - [05/Jul/2001:22:48:51 -0500] "GET /test.php HTTP/1.1"
> > 200 995
> > How could I get the IP (192.168.1.1) out of that? I've been playing
> > with regexps like this:
> > if/(.*)\s-\s-\s/;
> >
> > but I have no idea if that's correct or not. Can anybody offer any
> > help?
> >
> > Thanks,
> > Tyler Longren
> > Captain Jack Communications
> > [EMAIL PROTECTED]
> > www.captainjack.com
> >
> >
> > --
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
>
> --
> http://www.5vs1.com - A Pearl Jam Fan Site
>
> "Only when the last tree is dead, the last river damned, and the last
> field paved, will we realize that we can't eat money."
>
> "Time is long and life is short, so begin to live while you still can."
> -Eddie Vedder
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>