Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Date extraction

by brick (Sexton)
on Jun 14, 2000 at 07:53 UTC ( #18042=note: print w/replies, xml ) Need Help??


in reply to Date extraction

Well, 

If I'm reading your question right...you'd want to lock and 
pop open the file(s) and sift for something like:
[0-3]\{0,1}[0-9]/s[/April//Apr//August/...]/s[0-9]\{4\}/s([aAbB]\.\{0, +1}[cCdD]\.\{0,1})*
My regex isn't awesome...but that should look for chunks that
begin with zero to one instances of 0-3, followed by a 0-9,
followed by a space, followed by that list of months {which is
the one section I'm a lot fuzzy on.} then followed by a space
and four consecutive digits 0-9 and then followed entirely by 
that last chunk that looks for zero or more instances of A.D.,
AD, a.d., ad, B.C., BC, b.c., and bc.{Although I haven't tried
it, either...I'm trying freehand on it, but it's a start.}

_If_ I'm reading you right.

Then you'd take that matched bit and dump it to your opened
output file until you had no more input file to munge. Close
your files and unlock them and you'd be done.

If you knew what date formats to expect, you could fiddle 
with the regex a bit, ditching the ad/bc part if unnecessary
or shortening the month listing to either full months or the
abbreviated ones.

just my shot at it.

-brick.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://18042]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2018-06-25 04:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?



    Results (126 votes). Check out past polls.

    Notices?