Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

RE: RE: Re: $1

by Ted Nitz (Chaplain)
on Jun 21, 2000 at 19:38 UTC ( #19257=note: print w/replies, xml ) Need Help??

in reply to RE: Re: $1
in thread $1

I like that regex more, but there are still a few minor changes I would make.
while (<>){ if(/ ( [0-3]?[0-9](?:th|st|nd|rd)?\s+ # Get day (?: # Get month Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?| Apr(?:il)?|May|Jun(?:e)?|Jul(?:y)?| Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober)?| Nov(?:ember)?|Dec(?:ember)? )\s+ [0-9]{2,4} # Get Year ) /ix) { print "$1\n"; } }
The (?:) things are just like normal ()'s except they don't capture to a variable, they just do grouping, helps the interpreter optimize the regex.

The {x,y} means require atleast x of the previous item, and at most y. For refrence you can also say {x} which means require x of them, or {x,} which means atleast x.

Replies are listed 'Best First'.
RE: RE: RE: Re: $1
by Odud (Pilgrim) on Jun 21, 2000 at 22:34 UTC
    Oh I agree entirely - it was a just a quick solution to the problem, not an attempt at an optimal one. There's a date parser module available through CPAN which I would normally use. I don't know if it copes with 2nd, 4th, etc. though.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2018-03-18 02:21 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (228 votes). Check out past polls.