This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author r.david.murray
Recipients Jason.Stumpf, dbenbenn, ezio.melotti, janzert, mrabarnett, r.david.murray, serhiy.storchaka
Date 2013-09-20.01:36:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1379640998.4.0.853923590419.issue19055@psf.upfronthosting.co.za>
In-reply-to
Content
The documentation is correct and unambiguous.  Regular expressions just aren't very intuitive.

The documentation says "Causes the resulting RE to match 0 or more repetitions of the preceding RE, as many repetitions as are possible."  "as many repetitions of the preceding RE" means that:

  (a|ab)*

is equivalent to

  (a|ab)(a|ab)(a|ab)...

where "..." represents "add copies of the RE until it doesn't match".

Then you have to look at the documentation of '|' to see what it matches, and that documentation (already quoted) explains why the expanded pattern only matches 'a' in 'aba'.

Perhaps it would be clearer if it read "Causes the RE to be evaluated as if there were zero or more repetitions of the preceding RE, as many repetitions as produce matches"?
History
Date User Action Args
2013-09-20 01:36:38r.david.murraysetrecipients: + r.david.murray, dbenbenn, ezio.melotti, mrabarnett, serhiy.storchaka, janzert, Jason.Stumpf
2013-09-20 01:36:38r.david.murraysetmessageid: <1379640998.4.0.853923590419.issue19055@psf.upfronthosting.co.za>
2013-09-20 01:36:38r.david.murraylinkissue19055 messages
2013-09-20 01:36:37r.david.murraycreate