OK. Thanks for the help, my code now works.

As an aside... The full line from my Apache log looks like this

66.27.20.108 - guest [22/May/2001:23:54:41 -0700] "GET /pe/_P1010159.jpg
HTTP/1.1" 200 2882

I used:
    .split to return the first three fields into IP, - (whatever that is) ,
and user,
    .scan(/\[.*]/) for the date & time in its intirety,
    .scan(/".*"/) for the httpd command,
    .scan(/\d+\s*\d+/) for the final two fields (httpd command and bytes
transferred I believe)

Time taken to parse 3041 records on a PPro200 = 3.5 seconds.
I imagine a single .scan() method to return all fields at once would
decrease the time taken substantially.

-Luke

"Johan Dahl" <Johan.Dahl / ling.lu.se> wrote in message
news:a05100e02b739c674c5bb@[212.181.137.250]...
> >err, my current code looks something like this (noting that it does not
in
> >fact work)
> >
> >regExpr1 = /\d+'/'\s+'/'\d+/
> >@day, @month, @year = date.scan(regExpr1)
> >
> >-Luke
> >
> >
> >"Luke Crook" <lcluke / wsbnet.com> wrote in message
> >news:9f12ej$1a5 / dispatch.concentric.net...
> >>  I am trying to parse an Apache log file. The date field looks like:
> >>      [22/May/2001:23:54:41 -0700]
> >>
> >>  How would I use the .scan() method when '/' is the delimiter (I'm
trying
> >to
> >>  store day, month, year as seperate fields).
> >>  I have tried \/, "/" , '/', and even [/] but these do not work.
> >>
> >>  -Luke Crook
> >>
> >>
>
> Hi
>
> You are using the wrong function. scan should match the whole pattern
> for each item in the produced array so for example
> "1/2/3".scan(/\d+/) ==> ["1", "2", "3"]. Use the regular expression
> matching operator =~ (equals tilde) instead.
>
> Like this
>
> date = "[22/May/2001:23:54:41 -0700]"
>
> date =~ /(\d+)\/(\S+)\/(\d+)/
>
> @day, @month, @year = $1, $2, $3
>
> Notice \S matches any non-whitespace character. \s matches whitespace
>
>
> --
> Johan Dahl, Research Engineer
> Department of Linguistics and Phonetics, Lund University
> Address: Helgonabacken 12, 223 62 Lund, SWEDEN
> Tel: +46-(0)46-2228443 Fax: +46-(0)46-2224210
> E-mail: mailto:Johan.Dahl / ling.lu.se
> WWW: http://www.ling.lu.se/persons/Johan/