I am right in the middle of doing text parsing so I used your example as a mental exercise. :-)
Here's a NDFA for your text: b 0 1-9 a-Z , . + - ' " \n S0: S0 E E S1 E E E S3 E S2 E S1: T1 E E S1 E E E E E E T1 S2: S2 E E S2 E E E E E T2 E S3: T3 E E S3 E E E E E E T3 and the end-states are: E: error in text T1: You have the words: moo, cow T2: You get "farmer john" (w quotes) T3: You get zug Can't gurantee that I did it right - I did it really quick - and it's *specific* to your text string. Now just need to hire a programmer to write some clean Python parsing code. :-) -- It's me "Freddie" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Happy new year! Since I have run out of alcohol, I'll ask a question that I > haven't really worked out an answer for yet. Is there an elegant way to turn > something like: > > > moo cow "farmer john" -zug > > into: > > ['moo', 'cow', 'farmer john'], ['zug'] > > I'm trying to parse a search string so I can use it for SQL WHERE constraints, > preferably without horrifying regular expressions. Uhh yeah. > > From 2005, > Freddie > -- http://mail.python.org/mailman/listinfo/python-list