re.match -- not greedy?

Fredrik Lundh fredrik at pythonware.com
Wed Nov 22 02:28:55 EST 2006


EXI-Andrews, Jack wrote:

 > > that's a misunderstanding of what a regular expression is, though:
 > > conceptually, a RE describes a set of strings, and the RE engine is
 > > designed to answer the question "does this string belong to this
 > > set".

 > if that's so, what is the point of +? and *?   (?)

to influence which string to pick from the set, when a target string can 
match multiple members.

> seems to me it's a bit more pragmatic than pure set membership

your assertion was that a RE should *fail* if you used greedy matching. 
  that's not how RE's work.

</F>




More information about the Python-list mailing list