Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

regex: extract multiple number of date patterns from certain lines

by Random_Walk (Prior)
on Mar 04, 2009 at 15:49 UTC ( [id://748204]=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    2009-02-02 06:12:57,500 dates processed: 2009-01-31, 2009-01-29, 2009-
    +01-30
    2009-02-18 06:03:47,713 dates processed: 2009-02-16, 2009-02-17
    2009-02-19 05:58:29,138 dates processed: 2009-02-18
    
  2. or download this
    @res =$_ =~/(\d{4}-\d\d-\d\d)/g
    # gets them all but also from lines without 'dates processed'
    ...
    @res = $_ =~/(\d{4}-\d\d-\d\d).*dates processed: ((\d{4}-\d\d-\d\d)*)/
    # gets the right number of results but the final list all the same val
    +ue!
    
  3. or download this
    @res = $_ =~/(\d{4}-\d\d-\d\d).*dates processed: ((\d{4}-\d\d-\d\d,? ?
    +)*)
    # almost gets it but now have one too many results in the tail 
    # due to the nested braces
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://748204]
Approved by Bloodnok
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (5)
As of 2024-04-18 01:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found