* operator not working correctly with sub() (original) (raw)

Original report by Anonymous.


>>> regex.sub('.*', 'x', 'test')
u'xx' <--- This is wrong

>>> regex.sub('.+', 'x', 'test')
u'x'

>>> re.sub('.*', 'x', 'test')
u'x' <--- This is correct

>>> regex.sub('.*?', '|', 'test')
u'|||||||||' <--- This is wrong

>>> re.sub('.*?', '|', 'test')
u'|t|e|s|t|' <--- This is correct

python 2.7 64-bit linux, compiled from source regex version 2.4.39