Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: P::RD and grammar (Parse::RecDescent)

by toolic (Bishop)
on Nov 12, 2013 at 21:03 UTC ( [id://1062268]=note: print w/replies, xml ) Need Help??


in reply to P::RD and grammar

I've never used it before, but it looks fun! I think you should start small, then build up your grammar. I got rid of the square brackets around you month names. They are for regex character classes, if I understand this module correctly:
my $grammar = q{ transaction: date date: /(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\ +s+\d{1,2},/ }; # My output... # $VAR1 = 'Oct 31,';

UPDATE: and a little more readable:

my $grammar = q{ transaction: date date: /( (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|D +ec) # Month \s+ \d{1,2} , \s+ \d{4} + # Day, Year ) \s+ (\d{1,2} : \d{1,2}) : \d{1,2} \s+ (A|P)M + # Time \s+ PCKLog \s+ log /x };

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (None)
    As of 2024-04-25 01:33 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found