New submission from Jason Stumpf:
>>> re.match('(a|ab)*',('aba')).group(0)
'a'
According to the documentation, the * should match as many repetitions as
possible. 2 are possible, it matches 1.
Reversing the order of the operands of | changes the behaviour.
>>> re.match('(ab|a)*',('aba')).group(0)
'aba'
----------
messages: 198116
nosy: Jason.Stumpf
priority: normal
severity: normal
status: open
title: Regular expressions: * does not match as many repetitions as possible.
type: behavior
versions: Python 2.7
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue19055>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com