On Aug 12, 1:31 pm, Fabio Z Tessitore <[EMAIL PROTECTED]> wrote: > 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
I sort of get what the metacharacters "(", ")" and "[" ,"]" , groups are marked by the "(", ")" no? So I get this: >>> import re >>> re.match("ab(c)d","abcd") <_sre.SRE_Match object at 0xb7d72c60> >>> m= re.match("ab(c)d","abcd") >>> m.groups() ('c',) I can see clearly here that 'c' is group(1), because of the "..(c).. ". I cannot see how 'c' is a inner group in the expressions "([abc]) +" above? -- http://mail.python.org/mailman/listinfo/python-list