Georg Brandl <ge...@python.org> added the comment:

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.

----------
nosy: +georg.brandl
resolution:  -> wont fix
status: open -> closed

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue10139>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to