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 georg.brandl
Recipients georg.brandl, tzot
Date 2010-10-19.07:33:24
SpamBayes Score 1.6931272e-05
Marked as misclassified No
Message-id <1287473606.82.0.778728172353.issue10139@psf.upfronthosting.co.za>
In-reply-to
Content
I'm not sure this is valid.  First, I think I have a much easier example:

>>> import re
>>> re.search('bc|abc', 'abc').group()
'abc'

I assume you'd expect this to give 'bc' as well.  However, for a string s, "search" looks for matches looking at s, then looking at s[1:], then s[2:], and so on.  For s, it looks at both branches, and the second branch matches.

This can be inferred from the docs of "search": """Scan through string looking for a location where the regular expression pattern produces a match;""", for the first location a match is produced for the second branch.
History
Date User Action Args
2010-10-19 07:33:26georg.brandlsetrecipients: + georg.brandl, tzot
2010-10-19 07:33:26georg.brandlsetmessageid: <1287473606.82.0.778728172353.issue10139@psf.upfronthosting.co.za>
2010-10-19 07:33:24georg.brandllinkissue10139 messages
2010-10-19 07:33:24georg.brandlcreate