Parse and extract?

0 views
Skip to first unread message

felciano

unread,
Jul 20, 2008, 11:19:53 PM7/20/08
to parsedatetime-dev
Hi --

I'm loving parsedatetime -- it is a great module! Is it possible to
use the parser to grab dates out of the middle of strings? I would
like to grab dates from task description sentences like this:

- Finish the Report #next friday @home
- #next friday finish the report
- Email George about tennis #jan 5 08
- Get a loan #tomorrow (2 hours)

I'm trying to keep the syntax minimal, but I can reasonably rely on
using a simple delimiter like # to indicate where a date string
starts. However, there may be other text following the date, like a
category tag (@home), duration (2 hours), etc. So what I'd like is to
be able to pass in "#next friday finish the report" into parse and
have it return a (datetuple, restofstring) tuple, where restofstring
would be " finish the report".

Is there a straightforward way to do this with parsedatetime today?

Thanks!

Ramon
Reply all
Reply to author
Forward
0 new messages