Jason Stumpf added the comment:

Even with the documentation to |, the documentation to * is wrong.

>>> re.match('(a|ab)*c',('abac')).group(0)
'abac'

>From the doc: In general, if a string p matches A and another string q matches 
>B, the string pq will match AB.

Since '(a|ab)*c' matches 'abac', and 'c' matches 'c', that means '(a|ab)*' 
matches 'aba'.  It does so with 2 repetitions.  Thus, in the example from my 
initial post, it was not matching with as many repetitions as possible.

I think what you mean is that * attempts to match again after each match of the 
preceding regular expression.

----------

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

Reply via email to