pyparsing ambiguity

Posted by Claudiu on Stack Overflow See other posts from Stack Overflow or by Claudiu
Published on 2010-06-05T21:40:58Z Indexed on 2010/06/05 23:42 UTC
Read the original article Hit count: 307

Filed under:
|
|

I'm trying to parse some text using PyParser. The problem is that I have names that can contain white spaces. So my input might look like this:

Joe
Bob
Jimmy Foo
Joe decides to eat.
Bob decides to not eat.
Jimmy Foo decides to eat.

How can I create a parser for the decides to eat line? If I create my name parser naively, meaning with alphabetic characters plus space characters, then it will match the entire line.

© Stack Overflow or respective owner

Related posts about python

Related posts about parsing