[Tutor] uncomprehension on RE

cedric briner work at infomaniak.ch
Wed Sep 19 10:23:49 CEST 2007


Hello,

I do not understand the behaviour of this:

import re
re.search('(a)*','aaa').groups()
('a',)

I was thinking that the ``*'' will operate on the group delimited by the 
parenthesis. And so, I was expecting this result:
('a', 'a', 'a')

Is there something I'am missing ?

Ced.

-- 

Cedric BRINER
Geneva - Switzerland


More information about the Tutor mailing list