pyparsing: parseString confusion

Peter Fein pfein at
Fri Mar 11 19:24:13 CET 2005

My understanding of parseString seems flawed: I thought the grammar must
match the string in its entirety, based on the following from the howto:

"scanString allows you to scan through the input source string for
random matches, instead of exhaustively defining the grammar for the
entire source text (as would be required with parseString)"

>>> from pyparsing import *
>>> alphas
>>> word=Word(alphas)
>>> word.parseString("foo888")
(['foo'], {})

I'd expect this to raise an exception.  What am I missing here?

Peter Fein                 pfein at                 773-575-0694

Basically, if you're not a utopianist, you're a schmuck. -J. Feldman

More information about the Python-list mailing list