By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,898 Members | 1,198 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,898 IT Pros & Developers. It's quick & easy.

pyparsing: parseString confusion

P: n/a
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 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVW XYZ' word=Word(alphas)

(['foo'], {})

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

Peter Fein pf*** 773-575-0694

Basically, if you're not a utopianist, you're a schmuck. -J. Feldman
Jul 18 '05 #1
Share this Question
Share on Google+
1 Reply

P: n/a
I've notice the same thing. It seems that it will return as much as it
can that matches the grammar and just stop when it encounters something
it doesn't recognize.

Jul 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.