Regular Expression Grouping

Fabio Z Tessitore fabioztessitore at libero.it
Sun Aug 12 13:31:42 EDT 2007


Il Sun, 12 Aug 2007 17:21:02 +0000, linnewbie ha scritto:

> Fairly new to this regex thing, so this might be very juvenile but
> important.
> 
> I cannot understand and why 'c' constitutes a group here without being
> surrounded by "(" ,")" ?
> 
>>>>import re
>>>> m = re.match("([abc])+", "abc")
>>>> m.groups()
> ('c',)
> 
> Grateful for any clarity.

thera are () outer [], maybe you don't know what do [] mean? or you want 
to know why 'c' and not 'a' or 'b'
bye



More information about the Python-list mailing list