Re: [Pyparsing] Matching everything up to a point.
Brought to you by:
ptmcg
From: Paul M. <pa...@al...> - 2006-12-10 12:03:21
|
SkipTo, perhaps? expression = SkipTo("on").setResultsName("taskDesc") + \ "on" + \ date.setResultsName("taskDate") -- Paul > -----Original Message----- > From: pyp...@li... [mailto:pyparsing- > use...@li...] On Behalf Of Poromenos > Sent: Saturday, December 09, 2006 6:12 PM > To: pyp...@li... > Subject: [Pyparsing] Matching everything up to a point. > > Hello all, > I have spent the better part of today writing a parser to parse > natural language sentences, specifically dates. What I want to do is > something like: > > Doctor's appointment on November 20 > > I have completed the parsing of the date part (everything from "on" > until the end), and I went on to add the term to catch everything > before the on like so: > > expression = task + date > > only to find to my chagrin that it cannot match. It is raising an > exception that it expects an "on" at the end of the line. Can anyone > tell me how to match everything up until a recognisable (to the > parser) date? > > Thanks > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share > your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Pyparsing-users mailing list > Pyp...@li... > https://lists.sourceforge.net/lists/listinfo/pyparsing-users |