Home

On Aug 12, 1:31 pm, Fabio Z Tessitore <fabioztessit...@libero.it>
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?

previous
next

What's on at APL 2007, Montreal, October 21, (Tutorials) 22,23 (Program)
Re: directpython question
Re: Address of a member function
Re: C++ Primer ex 7.6
Re: Stream states questions
odwiew.elblag.pl
typy bukmacherskie
Podnośniki
Bóg Biblia Mesjasz
wnętrza poznań