Re: [Pyparsing] Matching everything up to a point.
Brought to you by:
ptmcg
From: Poromenos <por...@po...> - 2006-12-10 12:06:27
|
That works, thanks a lot! :/ I was doing task = Words(alphas + " ") expression = task + SkipTo("on").setResultsName("taskDesc") + \ "on" + \ date.setResultsName("taskDate") and it wasn't working. Now it works like a charm, although I have run into some weird bugs which I have reported. Thanks again. On 12/10/06, Paul McGuire <pa...@al...> wrote: > 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 > > > |